UNPKG

@tsed/common

Version:
45 lines (44 loc) 1.49 kB
import { InjectorService } from "@tsed/di"; import { PlatformLoggerSettings } from "../../config/interfaces/PlatformLoggerSettings"; import { IMiddleware } from "../../mvc/interfaces/IMiddleware"; import { OnResponse } from "../../platform-builder/interfaces/OnResponse"; import { Context } from "../decorators/context"; /** * @middleware * @platform */ export declare class PlatformLogMiddleware implements IMiddleware, OnResponse { protected static DEFAULT_FIELDS: string[]; $onResponse: any; protected settings: PlatformLoggerSettings; constructor(injector: InjectorService); /** * Handle the request. */ use(ctx: Context): void; /** * The separate onLogStart() function will allow developer to overwrite the initial request log. * @param ctx */ protected onLogStart(ctx: Context): void; /** * Called when the `$onResponse` is called by Ts.ED (through Express.end). */ protected onLogEnd(ctx: Context): void; /** * Attach all information that will be necessary to log the request. Attach a new `request.log` object. */ protected configureRequest(ctx: Context): void; /** * Return complete request info. * @returns {Object} * @param ctx */ protected requestToObject(ctx: Context): any; /** * Return a filtered request from global configuration. * @returns {Object} * @param ctx */ protected minimalRequestPicker(ctx: Context): any; }