[QUESTION] Why `PinoLogger` instance don't show the error object
See original GitHub issueWhen I use a PinoLogger
instance to display some error object like this.logger.error(Error('foo'))
I get this:
{
"level": 50,
"time": 1590422389076,
"pid": 27787,
"hostname": "--",
"name": "app",
"req": {
"id": 1,
"method": "GET",
"url": "--",
"headers": {
"host": "localhost:3000",
"user-agent": "insomnia/7.1.1",
"accept": "*/*"
},
"remoteAddress": "127.0.0.1",
"remotePort": 52126
},
"context": "ExceptionsHandler"
}
seems like the arg isn’t serialized by pino.stdSerializers.err
because
this.logger.error( pino.stdSerializers.err(Error('foo')) )
works as expected (with { type, message, stack }
). This happen even when I explicity define the serializers. Is it the right behavior?
Great lib btw!
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Inconsistent Error logging · Issue #642 · pinojs/pino - GitHub
I've observed a few inconsistencies in logging of Error objects. ... The first output is the console output for comparison. In the second...
Read more >A Complete Guide to Pino Logging in Node.js - Better Stack
Learn how to start logging with Pino in Node.js and go from basics to best practices in no time.
Read more >Pino error log is empty, although error object contains ...
When using async logging (the default for the Pino logger), the process might have exited before all of the logging has been processed....
Read more >Multithreaded Logging with Pino - Matteo Collina - YouTube
Almost every developer thinks that adding one more log line would not decrease the performance of their server... until logging becomes the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Good catch, thanks. I’ll try to see what can be done here
Pino expects Error object in
err
field and can correctly serialize it.Example: