- Always log to stdout. It is not the application's responsibility to route logs.
- Never, ever log credentials, passwords or any sensitive information.
- LogTown - You can use any logger you want underneath it.
By Pulkit Singhal:
I think I was able to crystallize what was bothering me about the state of logging in nodejs. Here are some high level use cases I'd like to see all mashed up and addressed by one library:
- Turning off logging in modules for tests like mocha (doable with env flag and any log library)
- Toggling logs in dependencies when troubleshooting (again nothing special if the dependency has env flag)
- Low level information like line numbers (tracer provides this)
- Log levels (bunyan/winston provide this but debug doesn't)
- Namespace based toggling for logs (bunyan/winston miss this while debug provides it)
- Human readable json print out to console AND files. Winston doesn't prettyPrint to log files and even what it does print is such a far cry from how it would look compared to console.log that without custom formatting I can't see how to use it. For example logging an array looks quite different, it almost made me think I had the wrong data structure the first time around.
I feel like there is some room for improvement. I would love to see debug and tracer mashed together somehow ... found debug-trace interestingly enough ... with the added capability to log to files and have log levels.