UNPKG

rexuws

Version:

An express-like framework built on top of uWebsocket.js aims at simple codebase and high performance

24 lines (23 loc) 1.03 kB
import { ILoggerProvider } from '../../../Logger'; import { IRequest, IResponse } from '../../../utils/types'; import { NextFunction } from '../../core'; /** * A simple HttpLogger inspired by morgan * * The message will be printed over info() method if the req.end() incl: send, json, sendStatus, sendFile (non streaming), gets executed. * * Warning: The peformance will be degraded when you use the module even when the logging level (in case you use the built-in Logger) is set to false * it'd be better if this middleware is used in development mode only * * Passing a custom console which must be extended from ILoggerProvider (@default console) * * If you want to use global application logging setting, use the code below * * @example * import rex, { getLoggerInstance, httpLogger } from 'rex' * const app = rex(); * app.use(httpLogger(getLoggerInstance())) * * @param opts */ export declare const httpLogger: (_logger?: ILoggerProvider) => (req: IRequest, res: IResponse, next: NextFunction) => void;