diff --git a/morgan/morgan-tests.ts b/morgan/morgan-tests.ts index 00e67f875..4a0df9902 100644 --- a/morgan/morgan-tests.ts +++ b/morgan/morgan-tests.ts @@ -23,7 +23,9 @@ morgan('combined', { buffer: true, immediate: true, skip: function (req, res) { return res.statusCode < 400 }, - stream: (str: string) => { - console.log(str); + stream: { + write: (str: string) => { + console.log(str); + } } }); diff --git a/morgan/morgan.d.ts b/morgan/morgan.d.ts index b889bc7be..048fce3d4 100644 --- a/morgan/morgan.d.ts +++ b/morgan/morgan.d.ts @@ -12,6 +12,13 @@ declare module "morgan" { export function token(name: string, callback: (req: express.Request, res: express.Response) => T): express.RequestHandler; + export interface StreamOptions { + /** + * Output stream for writing log lines + */ + write: (str: string) => void; + } + /*** * Morgan accepts these properties in the options object. */ @@ -36,7 +43,7 @@ declare module "morgan" { * Output stream for writing log lines, defaults to process.stdout. * @param str */ - stream?: (str: string) => void; + stream?: StreamOptions; } }