CorrelationDecoratorOptions
Defined in: decorators/with-correlation.decorator.ts:27
Options for the WithCorrelation decorator.
Properties
Section titled “Properties”extract?
Section titled “extract?”
optionalextract?:CorrelationExtractor
Defined in: decorators/with-correlation.decorator.ts:55
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?:CorrelationLogger
Defined in: decorators/with-correlation.decorator.ts:95
Logger to write through instead of the decorated instance’s logger property or
console.
Accepts any object with the methods of CorrelationLogger (e.g. a Pino or Winston adapter).
Example
Section titled “Example”@WithCorrelation({ logger: myPinoLogger })async handleJob(job: Job) { ... }logLevel?
Section titled “logLevel?”
optionallogLevel?:LogLevel|"none"
Defined in: decorators/with-correlation.decorator.ts:80
Log level for the start of the method execution.
- Any LogLevel value routes to the logger method of that name (
'log','debug','verbose','warn','error'). 'none'suppresses the log message entirely.
A pino-backed logger maps the levels as 'verbose' → trace, 'debug' → debug,
'log' → info, 'warn' → warn, 'error' → error, 'fatal' → fatal.
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:39
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'