go logging registers as errors
project id: 271ed33d-be6b-40ce-96ba-504a94362dac
howdy y'all. I'm hosting a go app on railway and it's been great but whenever I use go's default logger or charm log, all of my logs show up as errors instead of info. I have tried modifying the default logger's output to ensure it's not printing to standard err but it's still categorizing all of my logging as errors. Just wondering if anyone has any insight as to why this is happening.
36 Replies
Project ID:
271ed33d-be6b-40ce-96ba-504a94362dac
you are on the right track, sending logs to stdout instead of stderr would print them as info, can you please provide a minimal reproducible example for me to test
yeah i'll whip one up when i get back to my computer
sounds good!
ok i think this should do it
what version of go do you use
i tried both
log.Default().setOutput()
and log.setOutput()
and both seem to send to stderr anyways
1.22is cmp.Or a thing in that version?
it is indeed
little tip but it has nothing to do with logs -
port := cmp.Or(os.Getenv("PORT"), "8080")
saves 3 lines hahathat's pretty nice. never used that before lol
okay ill get to testing now
thanks so much!
well not off to a good start
![No description](https://cdn.answeroverflow.com/1261584026741768263/image.png)
oh that's totally my bad
no lsp in discord code blocks
capitals for public methods is right. I've been writing too much rust
okay so it looks like you just can't set the default logger's output to stdout