[BUG] logger.assign does not add properties to "request completed" log.
See original GitHub issue[x] I’ve read the docs of nestjs-pino
[x] I’ve read the docs of pino
[x] I couldn’t find the same open issue of nestjs-pino
What is the current behavior?
When I call this.logger.assign({ someKey: someValue })
, the key is properly added to the logs that belong to a request except the one that marks the end of the request “Request completed”.
What is the expected behavior?
I would expect that the method this.logger.assign({ someKey: someValue })
adds the key and value to all the logs belonging to that request.
Please mention other relevant information such as Node.js version and Operating System.
I am using nestjs-pino 2.2.0.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Logging with Pino and AsyncLocalStorage in Node.js
In this post, you can learn what a logging library is, why you should use it, and how to log with Pino and...
Read more >7 Best Practices for C# Logging (With Examples)
To assign an output destination for your messages based on the logging level, create multiple appenders in your config file. For example, this...
Read more >Node.js Logging with Winston
Introducing Node Js Developers to Logging Using Winston Loggers. ... The console module cannot perform many custom configurations.
Read more >The 10 Most Common JavaScript Issues Developers Face
If you need help figuring out why your JavaScript isn't working, consult this list of the 10 most common JavaScript issues from a...
Read more >Uncaught TypeError: Cannot assign to read only property
When you use Object.defineProperties , by default writable is set to false , so _year and edition are actually read only properties.
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
Unfortunately, after spending a whole day on this I could not find a solution. I believe this feature should be made on
pino-http
first without adding any workarounds. Will add this limitation to docsJust checked such example:
and this doesn’t work.
All the suggested here dirty hacks cannot be used because it’s not universal for library with many users or add unnecessary complexity to configuration. Will check if we can solve this with
AsyncLocalStorage
, but in case if it’s not possible I’ll add this to the docs as a limitation of the underlying library.