-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Formatting example #1615
Comments
+1 |
Thanks! Could you clarify what this does that none of the examples in the readme or examples folder https://github.com/winstonjs/winston/tree/master/examples do? Just so we know how to call this snippet if we add it to the examples... |
Good point. The search and retrieve for examples is often the hardest part ... |
I also had trouble understanding how the formatters work. I set up this codesandbox. What I've learned is that a format specified when creating the logger sets up a "global" or "base" format. In my case, I tend to use Note that some "formats" simply "mutate" properties of the log entry, such as the level, or the message, while others actually specify an output format, e.g. Also, be aware if you are using multiple transports. I've come across what appears to be a nasty bug in Winston, where any transports after the first transport DO NOT get all the metadata that may be present on the |
It took me long time to figure out some simple formatting. The examples I found with a formatter function, simply did not work for me. Finally I got this working:
Maybe good to add to documentation?
The text was updated successfully, but these errors were encountered: