LoggingBehaviorOptions
Αυτό το περιεχόμενο δεν είναι ακόμη διαθέσιμο στη γλώσσα σου.
Defined in: packages/pipeline/src/behaviors/logging.behavior.ts:48
Configuration options for the logging behavior.
Levels use LogLevel names ('verbose', 'debug', 'log',
'warn', 'error', 'fatal').
When using nestjs-pino, these map to pino levels:
'verbose' → trace, 'debug' → debug, 'log' → info, 'warn' → warn,
'error' → error, 'fatal' → fatal.
Use 'none' to suppress a message entirely.
Example
Section titled “Example”Structured application logging with safe payload visibility
export const createUser = pipeline.wrap( { name: 'createUser', kind: 'command' }, [LoggingBehavior, { logFormat: 'structured', requestResponseLogLevel: 'debug', excludeRequestObj: false, excludeResponseObj: true, redactKeys: ['code'], mapLogLevel: new Map([[UniqueEmailException, 'warn']]), }],)(async (command: CreateUserCommand) => users.create(command));Properties
Section titled “Properties”errorLogLevel?
Section titled “errorLogLevel?”
optionalerrorLogLevel?:LogLevel|"none"
Defined in: packages/pipeline/src/behaviors/logging.behavior.ts:64
Log level used when the wrapped handler throws.
Uses LogLevel names or ‘none’ to suppress.
Overridden per error type when mapLogLevel has a matching entry.
Default: ‘error’.
excludeKeys?
Section titled “excludeKeys?”
optionalexcludeKeys?:string[]
Defined in: packages/pipeline/src/behaviors/logging.behavior.ts:93
Keys to exclude from request/response logs.
Passed to safeStringify/safeSanitize as a Set<string> for filtering object properties.
Supports dot notation for nested properties (e.g. 'ctx.sessionUser').
Example: ['password', 'token', 'ctx.sessionUser'] omits those fields from the log output.
Default: [] (no keys excluded).
excludeRequestObj?
Section titled “excludeRequestObj?”
optionalexcludeRequestObj?:boolean
Defined in: packages/pipeline/src/behaviors/logging.behavior.ts:135
If true, omits the request payload from logs entirely, logging the
placeholder '[exclude request obj]' instead.
Default: true.
excludeResponseObj?
Section titled “excludeResponseObj?”
optionalexcludeResponseObj?:boolean
Defined in: packages/pipeline/src/behaviors/logging.behavior.ts:142
If true, omits the response payload from logs entirely, logging the
placeholder '[exclude response obj]' instead.
Default: true.
logFormat?
Section titled “logFormat?”
optionallogFormat?:"text"|"structured"
Defined in: packages/pipeline/src/behaviors/logging.behavior.ts:153
Output shape for request/response/metric/error logs.
- ‘text’: single interpolated string (default).
- ‘structured’: plain object payload (e.g.
{ msg, request }for request/response, or{ message, stack, ... }for errors), suitable for structured loggers like nestjs-pino/pino that serialize objects into JSON fields. Default: ‘text’.
mapLogLevel?
Section titled “mapLogLevel?”
optionalmapLogLevel?:Map<ErrorClass,LogLevel|"none">
Defined in: packages/pipeline/src/behaviors/logging.behavior.ts:77
Per-exception-type log level override, keyed by error class.
When the thrown error is an instanceof more than one registered key,
the most specific (most derived) matching class wins — e.g. with both
Error and ForbiddenException registered, a thrown ForbiddenException
logs at the ForbiddenException level, regardless of the order the
entries were inserted into the Map. Falls back to errorLogLevel when
no key matches.
Example: new Map([[Error, 'error'], [ForbiddenException, 'warn']])
metricLogLevel?
Section titled “metricLogLevel?”
optionalmetricLogLevel?:LogLevel|"none"
Defined in: packages/pipeline/src/behaviors/logging.behavior.ts:56
Log level for the post-success metric line (correlation ID, request
kind/name, handler name, and elapsed duration in ms). Emitted once
next() resolves without throwing.
Uses LogLevel names or ‘none’ to suppress.
Default: ‘log’.
redactKeys?
Section titled “redactKeys?”
optionalredactKeys?:string[]
Defined in: packages/pipeline/src/behaviors/logging.behavior.ts:110
Additional keys or dot-paths to mask with [REDACTED] when request/response
payload logging is enabled. Unlike excludeKeys, redacted properties
stay in the payload so its shape remains visible.
This option is additive and has no effect unless configured.
Example
Section titled “Example”logging({ excludeRequestObj: false, redactKeys: ['profile.email', 'payment.cardToken'],});redactSensitiveKeys?
Section titled “redactSensitiveKeys?”
optionalredactSensitiveKeys?:boolean
Defined in: packages/pipeline/src/behaviors/logging.behavior.ts:128
Masks the core DEFAULT_REDACT_KEYS (password, token, authorization, cookie, API keys, card data, etc.) in request/response payload logs. Custom redactKeys are merged on top.
Defaults to true. Set it to false only when raw payload logging is an
explicit application requirement and the caller owns the resulting exposure
risk.
Default
Section titled “Default”trueExample
Section titled “Example”Opting out, deliberately
logging({ excludeRequestObj: false, redactSensitiveKeys: false });requestResponseLogLevel?
Section titled “requestResponseLogLevel?”
optionalrequestResponseLogLevel?:LogLevel|"none"
Defined in: packages/pipeline/src/behaviors/logging.behavior.ts:84
Log level for request/response payloads. Uses LogLevel names or ‘none’ to suppress. Default: ‘debug’.