Skip to content
Discussion options

You must be logged in to vote

@ArtemSkok-Leia ,

what you call "context" is options returned and collected from all the Middleware connected to EndpointsFactory you produce the Endpoint on.

So, if you

would not like to modify the request and set the requestId property of it inside of createChildLogger function

(which is childLoggerProvider config option), then you can do it in a Middleware, like this

export const myFactory = defaultEndpointsFactory.addMiddleware({
  input: z.object({
    requestId: z.string(), // client defines it
  }),
  handler: async ({ input: { requestId }, request, logger }) => {
    (request as any).requestId = requestId;
    const myLogger = logger.child({ requestId });
    return { myLogger,

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
1 reply
@ArtemSkok-Leia
Comment options

Comment options

You must be logged in to vote
6 replies
@ArtemSkok-Leia
Comment options

@RobinTail
Comment options

@ArtemSkok-Leia
Comment options

@RobinTail
Comment options

Answer selected by RobinTail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants