Golnag's log.Printf seems to be displayed as stderr
Hey everyone, I'm working on a small application in go and using the built in logger (at least for now). I am not seeing anything werid about it locally but when in prod viewing the deployment logs, everything is in red as an error would be displayed.
Toggling the "Stderr highlighting" in the options at the bottom of the log viewer confirms my suspissions about railway thinking these are errors which they are not.
Any assitance here would be greatly appreciated!
5 Replies
Project ID:
d82ba0ad-d9bf-42aa-8567-4dd480f7d1ba
d82ba0ad-d9bf-42aa-8567-4dd480f7d1ba
Printf does indeed print to stderr
https://cs.opensource.google/go/go/+/refs/tags/go1.20.6:src/log/log.go;l=350
https://cs.opensource.google/go/go/+/refs/tags/go1.20.6:src/log/log.go;l=86
you can construct your own logger that prints to os.stdout
https://go.dev/play/p/YMagpcuisE-
AH! my mistake, thanks for the info @Brody
no worries! happy to help 🙂