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
Fastify includes a log member in the request, which makes it possible to output request-scoped logs. Specifically, the output logs include a reqId which is unique to every request, but consistent across all logs generated within the scope of a request, making it possible to better analyze logs later.
It would be very useful to be able to access this logger from within request handlers. I presume the logger could output non-request-scoped logs in other plugins if the system they integrate into doesn't have request-scoped logging (e.g. connect-express, AFAICT).
This would be useful in Connect for Node.js - I don't think it would apply to Connect for Web.
I have tried to capture the log member from the Fastify object and use it within request handlers, but the logs generated by that logger are not request-scoped.
The text was updated successfully, but these errors were encountered:
Ah, yes, that absolutely works - thanks! I think it would be useful to add this to the documentation, perhaps in the Context section, or an "Advanced" section.
Fastify includes a
log
member in the request, which makes it possible to output request-scoped logs. Specifically, the output logs include areqId
which is unique to every request, but consistent across all logs generated within the scope of a request, making it possible to better analyze logs later.It would be very useful to be able to access this logger from within request handlers. I presume the logger could output non-request-scoped logs in other plugins if the system they integrate into doesn't have request-scoped logging (e.g. connect-express, AFAICT).
This would be useful in Connect for Node.js - I don't think it would apply to Connect for Web.
I have tried to capture the
log
member from theFastify
object and use it within request handlers, but the logs generated by that logger are not request-scoped.The text was updated successfully, but these errors were encountered: