CorrelationDecoratorOptions
Defined in: decorators/with-correlation.decorator.ts:24
Options for the WithCorrelation decorator.
Properties
Section titled “Properties”extract?
Section titled “extract?”
optionalextract?:CorrelationExtractor
Defined in: decorators/with-correlation.decorator.ts:52
Custom extractor function. Receives all method arguments.
Takes precedence over path.
Example
Section titled “Example”// RabbitMQextract: (data, ctx) => ctx.getMessage().properties.correlationId
// Kafkaextract: (data, ctx) => ctx.getMessage().headers?.['x-correlation-id']?.toString()logger?
Section titled “logger?”
optionallogger?:LoggerService
Defined in: decorators/with-correlation.decorator.ts:94
Custom logger instance to use instead of the built-in NestJS Logger.
Accepts any object that implements LoggerService (e.g. a Pino or Winston adapter).
Example
Section titled “Example”@WithCorrelation({ logger: myPinoLogger })async handleJob(job: Job) { ... }logLevel?
Section titled “logLevel?”
optionallogLevel?:"verbose"|"debug"|"log"|"warn"|"error"|"fatal"|"none"
Defined in: decorators/with-correlation.decorator.ts:80
Log level for the start of the method execution.
- Any NestJS LogLevel value routes to the corresponding
Loggermethod ('log','debug','verbose','warn','error'). 'none'suppresses the log message entirely.
When using nestjs-pino, NestJS levels map to pino levels as follows:
'verbose' → trace, 'debug' → debug, 'log' → info, 'warn' → warn,
'error' → error, 'fatal' → fatal.
To see 'verbose' logs, set level: 'trace' in LoggerModule.forRoot.
Default
Section titled “Default”'debug'Example
Section titled “Example”// Uses default 'debug' level@WithCorrelation()
// Log at 'verbose' level@WithCorrelation({ logLevel: 'verbose' })
// Suppress the log message@WithCorrelation({ logLevel: 'none' })
optionalpath?:string
Defined in: decorators/with-correlation.decorator.ts:36
Property path (dot-notation) to the correlation ID in the first argument.
- For Bull:
'data.correlationId'(default) - For a flat object:
'correlationId' - For deeply nested:
'metadata.tracing.correlationId'
Ignored when extract is provided.
Default
Section titled “Default”'data.correlationId'