export interface RequestInterface { headers: { [key: string]: string; }; payload?: any; } export interface ResponseInterface { headers: { [key: string]: string; }; payload?: any; } export interface RequestLog { url: string; request: RequestInterface; response: ResponseInterface; } export interface ChannelInterface { name: string; url?: string | undefined; } export interface StatusCodeInterface { OK200: string; OK300: string; ERROR400: string; ERROR500: string; OTHER: string; [key: string]: string; } export interface ChannelsInterface { DEFAULT: ChannelInterface; CONSOLE: ChannelInterface; } export declare class ExpressCaptureClass { /** * @private * where you want want to print your data * url is either the http url or absolute path(if channel is a local file) */ private channel; /** * * @param {Channel} channel * @return {ExpressCaptureClass} for chaining purposes */ setChannel(channel: ChannelInterface): ExpressCaptureClass; /** * @TODO it can be called alone, in this case it will assume that the channel is console * @param req * @param res * @param next */ capture(req: any, res: any, next: () => any): RequestLog; } export declare const expressCapture: ExpressCaptureClass; export declare const channels: ChannelsInterface; export declare const statusCodeMap: StatusCodeInterface; export declare function lookupByChannel(channel?: ChannelInterface): { log: (url: string, request: RequestInterface, response: ResponseInterface) => Promise; }; /** * * @param channel * @param status the list of status that will trigger logging, useful if you want to log "failed requests" (status of 500) only for example */ export declare function capture(channel?: ChannelInterface, status?: string | Array): (req: any, res: any, next: () => any) => () => any;