Comparing version 8.2.0 to 8.2.1
@@ -13,3 +13,3 @@ // Project: https://github.com/pinojs/pino-http#readme | ||
import pino from 'pino'; | ||
import { SerializedError, SerializedRequest, SerializedResponse } from 'pino-std-serializers'; | ||
import { err, req, res, SerializedError, SerializedRequest, SerializedResponse } from 'pino-std-serializers'; | ||
@@ -46,3 +46,3 @@ declare function PinoHttp(opts?: Options, stream?: pino.DestinationStream): HttpLogger; | ||
export interface GenReqId { | ||
(req: IncomingMessage): ReqId; | ||
(req: IncomingMessage, res: ServerResponse): ReqId; | ||
} | ||
@@ -63,2 +63,8 @@ | ||
export interface StdSerializers { | ||
err: typeof err; | ||
req: typeof req; | ||
res: typeof res; | ||
} | ||
export interface StdSerializedResults { | ||
err: SerializedError; | ||
@@ -65,0 +71,0 @@ req: SerializedRequest; |
@@ -8,3 +8,4 @@ | ||
import { Writable } from 'stream'; | ||
import pinoHttp, { AutoLoggingOptions, CustomAttributeKeys, GenReqId, HttpLogger, Options, ReqId, startTime, StdSerializers } from '.'; | ||
import { err, req, res } from 'pino-std-serializers'; | ||
import pinoHttp, { AutoLoggingOptions, CustomAttributeKeys, GenReqId, HttpLogger, Options, ReqId, startTime, StdSerializers, StdSerializedResults } from '.'; | ||
@@ -16,5 +17,6 @@ const logger = pino(); | ||
pinoHttp({ logger }).logger = logger; | ||
pinoHttp({ genReqId: (req: IncomingMessage) => req.statusCode || 200 }); | ||
pinoHttp({ genReqId: (req: IncomingMessage) => 'foo' }); | ||
pinoHttp({ genReqId: (req: IncomingMessage) => Buffer.allocUnsafe(16) }); | ||
pinoHttp({ genReqId: (req: IncomingMessage, res: ServerResponse) => req.statusCode || 200 }); | ||
pinoHttp({ genReqId: (req: IncomingMessage, res: ServerResponse) => res.statusCode || 200 }); | ||
pinoHttp({ genReqId: (req: IncomingMessage, res: ServerResponse) => 'foo' }); | ||
pinoHttp({ genReqId: (req: IncomingMessage, res: ServerResponse) => Buffer.allocUnsafe(16) }); | ||
pinoHttp({ useLevel: 'error' }); | ||
@@ -127,2 +129,8 @@ pinoHttp({ prettyPrint: true }); // deprecated but still present in pino. | ||
const stdSerializers: StdSerializers = { | ||
err: err, | ||
req: req, | ||
res: res | ||
} | ||
const stdSerializedResults: StdSerializedResults = { | ||
err: { | ||
@@ -129,0 +137,0 @@ type: 'type', |
{ | ||
"name": "pino-http", | ||
"version": "8.2.0", | ||
"version": "8.2.1", | ||
"description": "High-speed HTTP logger for Node.js", | ||
@@ -20,3 +20,3 @@ "main": "logger.js", | ||
"pino-http-print": "^3.1.0", | ||
"pino-pretty": "^8.0.0", | ||
"pino-pretty": "^9.0.0", | ||
"pre-commit": "^1.1.2", | ||
@@ -27,3 +27,3 @@ "split2": "^4.0.0", | ||
"ts-node": "^10.3.0", | ||
"tsd": "^0.22.0", | ||
"tsd": "^0.24.1", | ||
"typescript": "^4.4.4" | ||
@@ -30,0 +30,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72457
1689