@neoma/logging
Version:
Great logging for NestJs
27 lines (26 loc) • 1.12 kB
TypeScript
import { CallHandler, ExecutionContext, NestInterceptor } from "@nestjs/common";
import { LoggingConfiguration } from "@lib/interfaces";
import { Observable } from "rxjs";
/**
* Interceptor that logs requests going into and coming out of route handlers.
*/
export declare class RequestLoggerInterceptor implements NestInterceptor {
private readonly config;
/**
* Creates an instance of RequestLoggerInterceptor.
*
* @param config The logging configuration - the only property used is `logErrors`
* which determines whether errors caught during request processing should be logged
* automatically.
*/
constructor(config: LoggingConfiguration);
/**
* Intercepts the request and logs informtion about the route handler that the request
* will be dispatched to and the result of processing once route handler has handled
* the request.
*
* @param context Provides access to route handling information.
* @param next used to continue processing the request.
*/
intercept(context: ExecutionContext, next: CallHandler): Observable<any>;
}