From 022f8a9727d08ecce2cc71f363f4e73087414974 Mon Sep 17 00:00:00 2001 From: Jeremy Forsythe Date: Thu, 29 Aug 2019 21:01:00 -0400 Subject: [PATCH] [pino-http] Add new autoLogging flag from v4.3.0 (#37975) * [pino-http] Add new flag from v4.3.0 See https://github.com/pinojs/pino-http/pull/70 See https://github.com/pinojs/pino-http/releases/tag/v4.3.0 * bump version --- types/pino-http/index.d.ts | 9 ++++++++- types/pino-http/pino-http-tests.ts | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/types/pino-http/index.d.ts b/types/pino-http/index.d.ts index b0fea321aa..4c7a8d62c3 100644 --- a/types/pino-http/index.d.ts +++ b/types/pino-http/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for pino-http 4.0 +// Type definitions for pino-http 4.3 // Project: https://github.com/pinojs/pino-http#readme // Definitions by: Christian Rackerseder +// Jeremy Forsythe // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.7 @@ -15,11 +16,17 @@ declare function PinoHttp(stream?: DestinationStream): PinoHttp.HttpLogger; declare namespace PinoHttp { type HttpLogger = (req: IncomingMessage, res: ServerResponse) => void; + /** + * Options for pino-http + * + * See https://github.com/pinojs/pino-http#pinohttpopts-stream + */ interface Options extends LoggerOptions { logger?: Logger; genReqId?: GenReqId; useLevel?: Level; stream?: DestinationStream; + autoLogging?: boolean; customLogLevel?: (res: ServerResponse, error: Error) => Level; } diff --git a/types/pino-http/pino-http-tests.ts b/types/pino-http/pino-http-tests.ts index 013e23ae10..64d3b0d2ba 100644 --- a/types/pino-http/pino-http-tests.ts +++ b/types/pino-http/pino-http-tests.ts @@ -17,5 +17,6 @@ pinoHttp({ genReqId: (req) => 'foo' }); pinoHttp({ genReqId: (req) => Buffer.allocUnsafe(16) }); pinoHttp({ useLevel: 'error' }); pinoHttp({ prettyPrint: true }); +pinoHttp({ autoLogging: false }); pinoHttp(new Writable()); pinoHttp({ customLogLevel(req, res) { return 'info'; } });