Skip to content

Commit

Permalink
Automatically log request id
Browse files Browse the repository at this point in the history
  • Loading branch information
kibertoad committed Nov 28, 2023
1 parent f4570c4 commit 3aecf82
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/plugins/requestContextProviderPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ function plugin(fastify: FastifyInstance, opts: unknown, done: () => void) {
next: HookHandlerDoneFunction,
) {
req.reqContext = {
logger: req.log,
logger: req.log.child({
requestId: req.id,
}),
reqId: req.id,
}

Expand Down

0 comments on commit 3aecf82

Please sign in to comment.