You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Big fan of pino and was looking at leveraging pino-http to replace some outdated custom setup in our apps. I was looking at the recently added quietResLogger option and was hoping you could clarify its behavior (and perhaps its intended usage based on #235/#339?).
According to the README, setting quietResLogger to true will include the request id under reqId and "only contain req" (I assume that last bit is just a typo that is supposed to say "only contain res").
However, reqId is only included under res.log if quietReqLogger is also set. Is the intended usage to set both options as the unit tests seem to indicate?
This gets the request info auto logged when it's received
Then they can rely solely on res.log to get quiet logging with reqId during their business logic
Set only quietResLogger
Then use req.log at the start of a handler followed by only using res.log for quiet logging afterward, e.g.:
function handle (req, res) {
logger(req, res)
req.log.info('') // just log the request info
res.log.info('doing some work') // quiet logs with only reqId
...
res.log.inf('finished doing some work')
res.end('hello world')
}
However, I don't think either of the above approaches works if quietReqLogger is set since it suppresses req from both customReceivedMessage and req.log. Obviously I could log that req info in other ways even in quiet mode, but pino's consistent format is preferred.
Thanks and hopefully this made sense. Up way later than I should have been while reading docs and writing this. 😆
The text was updated successfully, but these errors were encountered:
Big fan of pino and was looking at leveraging pino-http to replace some outdated custom setup in our apps. I was looking at the recently added
quietResLogger
option and was hoping you could clarify its behavior (and perhaps its intended usage based on #235/#339?).According to the README, setting
quietResLogger
totrue
will include the request id underreqId
and "only containreq
" (I assume that last bit is just a typo that is supposed to say "only containres
").However,
reqId
is only included underres.log
ifquietReqLogger
is also set. Is the intended usage to set both options as the unit tests seem to indicate?Reading #235, I assumed the use case was either:
customReceivedMessage
andquietResLogger
res.log
to get quiet logging withreqId
during their business logicquietResLogger
req.log
at the start of a handler followed by only usingres.log
for quiet logging afterward, e.g.:However, I don't think either of the above approaches works if
quietReqLogger
is set since it suppressesreq
from bothcustomReceivedMessage
andreq.log
. Obviously I could log that req info in other ways even in quiet mode, but pino's consistent format is preferred.Thanks and hopefully this made sense. Up way later than I should have been while reading docs and writing this. 😆
The text was updated successfully, but these errors were encountered: