Μετάβαση στο περιεχόμενο

LoggingBehavior

Αυτό το περιεχόμενο δεν είναι ακόμη διαθέσιμο στη γλώσσα σου.

Defined in: packages/pipeline/src/behaviors/logging.behavior.ts:178

Pipeline behavior that logs each request/response and execution timing.

Emits the incoming request, a completion metric (duration), and the response, each at a configurable log level (see LoggingBehaviorOptions). Request and response payloads are excluded by default and can be opted in, with key-based exclusion/redaction. Logging and serialization failures do not change the handler result or error. If the wrapped handler throws, the error is logged — including its stack trace and, when present, the error’s optionalParams (see ErrorWithOptionalParams) — and then re-thrown unchanged. Writes through the logger passed to the constructor, or console.

const pipeline = createPipeline({ behaviors: [new LoggingBehavior(pinoAdapter)] });

new LoggingBehavior(logger?): LoggingBehavior

Defined in: packages/pipeline/src/behaviors/logging.behavior.ts:181

PipelineLogger

LoggingBehavior

handle(context, next): Promise<unknown>

Defined in: packages/pipeline/src/behaviors/logging.behavior.ts:196

Logs the request, a duration metric, and the response or error around next(), using the options from context.getBehaviorOptions(LoggingBehavior) and the defaults documented on LoggingBehaviorOptions.

IPipelineContext

The pipeline context for the current request.

NextDelegate

Delegate that invokes the next behavior/handler in the chain.

Promise<unknown>

The value resolved by next().

Whatever next() throws, unchanged, after logging it. A logging or serialization failure never changes the returned value or the error.

IPipelineBehavior.handle