[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
This commit is contained in:
Jeremy Forsythe 2019-08-29 21:01:00 -04:00 committed by Ron Buckton
parent 9f28d6bb69
commit 022f8a9727
2 changed files with 9 additions and 1 deletions

View File

@ -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 <https://github.com/screendriver>
// Jeremy Forsythe <https://github.com/jdforsythe>
// 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;
}

View File

@ -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'; } });