@loopback/logging
Version:
An extension exposes logging for Winston and Fluentd with LoopBack 4
28 lines (27 loc) • 1.24 kB
TypeScript
/// <reference types="express" />
import { Interceptor, InvocationContext, Provider, ValueOrPromise } from '@loopback/core';
import { Request, Response } from '@loopback/rest';
import morgan from 'morgan';
import { Logger } from 'winston';
/**
* A local interceptor that provides logging for method invocations.
*/
export declare class InvocationLoggingInterceptor implements Provider<Interceptor> {
private logger;
constructor(logger: Logger);
value(): <T>(invocationCtx: InvocationContext, next: () => ValueOrPromise<T>) => Promise<T>;
intercept<T>(invocationCtx: InvocationContext, next: () => ValueOrPromise<T>): Promise<T>;
}
export interface AccessLogOptions extends morgan.Options<Request, Response> {
format?: string | morgan.FormatFn;
}
/**
* A global interceptor that provides logging for http requests/responses.
*/
export declare class HttpAccessLogInterceptor implements Provider<Interceptor> {
private logger;
private morganOptions;
constructor(logger: Logger, morganOptions?: AccessLogOptions);
value(): <T>(invocationCtx: InvocationContext, next: () => ValueOrPromise<T>) => Promise<T>;
intercept<T>(invocationCtx: InvocationContext, next: () => ValueOrPromise<T>): Promise<T>;
}