nestjs-pino icon indicating copy to clipboard operation
nestjs-pino copied to clipboard

[QUESTION] how to use logger.assign with graphql

Open kerituni12 opened this issue 3 years ago • 2 comments

[x] I've read the docs of nestjs-pino

[x] I've read the docs of pino

[x] I couldn't find the same question about nestjs-pino

Question

How i can use logger.assign with nestjs graphql

PinoLoggerModule.forRoot({
      pinoHttp: {
        logger: logger,
        autoLogging: false,
      },
      forRoutes: [AppController, '*', { path: '/graphql', method: RequestMethod.ALL }],
      exclude: [{ method: RequestMethod.ALL, path: 'check' }],
    }),

I get the error unable to assign extra fields out of request scope

Please mention other relevant information such as Node.js version and Operating System.

kerituni12 avatar May 03 '22 19:05 kerituni12

I tried with https://github.com/iamolegga/nestjs-pino/issues/788#issuecomment-1019321440 but it doesn't work as expected

kerituni12 avatar May 03 '22 22:05 kerituni12

There are not any tests for assign in gql context, should be checked separately. You can try to create a test for this if you want to. I'll get back to this when I'll have free time

iamolegga avatar May 04 '22 17:05 iamolegga