Gathering detailed insights and metrics for pino-std-serializers
Gathering detailed insights and metrics for pino-std-serializers
Gathering detailed insights and metrics for pino-std-serializers
Gathering detailed insights and metrics for pino-std-serializers
🌲 A list of standard object serializers for the Pino logger
npm install pino-std-serializers
Typescript
Module System
Node Version
NPM Version
99.8
Supply Chain
100
Quality
80
Maintenance
100
Vulnerability
100
License
JavaScript (95.5%)
TypeScript (4.5%)
Total Downloads
1,185,761,259
Last Day
519,593
Last Week
10,327,905
Last Month
44,422,021
Last Year
455,392,453
MIT License
66 Stars
176 Commits
32 Forks
7 Watchers
2 Branches
38 Contributors
Updated on Jun 25, 2025
Minified
Minified + Gzipped
Latest Version
7.0.0
Package Id
pino-std-serializers@7.0.0
Unpacked Size
52.75 kB
Size
9.93 kB
File Count
21
NPM Version
10.5.0
Node Version
20.12.2
Published on
Apr 29, 2024
Cumulative downloads
Total Downloads
Last Day
-0.6%
519,593
Compared to previous day
Last Week
-7.6%
10,327,905
Compared to previous week
Last Month
1.9%
44,422,021
Compared to previous month
Last Year
53.1%
455,392,453
Compared to previous year
This module provides a set of standard object serializers for the Pino logger.
exports.err(error)
Serializes an Error
like object. Returns an object:
1{ 2 type: 'string', // The name of the object's constructor. 3 message: 'string', // The supplied error message. 4 stack: 'string', // The stack when the error was generated. 5 raw: Error // Non-enumerable, i.e. will not be in the output, original 6 // Error object. This is available for subsequent serializers 7 // to use. 8 [...any additional Enumerable property the original Error had] 9}
Any other extra properties, e.g. statusCode
, that have been attached to the
object will also be present on the serialized object.
If the error object has a cause
property, the cause
's message
and stack
will be appended to the top-level message
and stack
. All other parameters that belong to the error.cause
object will be omitted.
Example:
1const serializer = require('pino-std-serializers').err; 2 3const innerError = new Error("inner error"); 4innerError.isInner = true; 5const outerError = new Error("outer error", { cause: innerError }); 6outerError.isInner = false; 7 8const serialized = serializer(outerError); 9/* Result: 10{ 11 "type": "Error", 12 "message": "outer error: inner error", 13 "isInner": false, 14 "stack": "Error: outer error 15 at <...omitted..> 16 caused by: Error: inner error 17 at <...omitted..> 18} 19 */
exports.errWithCause(error)
Serializes an Error
like object, including any error.cause
. Returns an object:
1{ 2 type: 'string', // The name of the object's constructor. 3 message: 'string', // The supplied error message. 4 stack: 'string', // The stack when the error was generated. 5 cause?: Error, // If the original error had an error.cause, it will be serialized here 6 raw: Error // Non-enumerable, i.e. will not be in the output, original 7 // Error object. This is available for subsequent serializers 8 // to use. 9 [...any additional Enumerable property the original Error had] 10}
Any other extra properties, e.g. statusCode
, that have been attached to the object will also be present on the serialized object.
Example:
1const serializer = require('pino-std-serializers').errWithCause; 2 3const innerError = new Error("inner error"); 4innerError.isInner = true; 5const outerError = new Error("outer error", { cause: innerError }); 6outerError.isInner = false; 7 8const serialized = serializer(outerError); 9/* Result: 10{ 11 "type": "Error", 12 "message": "outer error", 13 "isInner": false, 14 "stack": "Error: outer error 15 at <...omitted..>", 16 "cause": { 17 "type": "Error", 18 "message": "inner error", 19 "isInner": true, 20 "stack": "Error: inner error 21 at <...omitted..>" 22 }, 23} 24 */
exports.mapHttpResponse(response)
Used internally by Pino for general response logging. Returns an object:
1{ 2 res: {} 3}
Where res
is the response
as serialized by the standard response serializer.
exports.mapHttpRequest(request)
Used internall by Pino for general request logging. Returns an object:
1{ 2 req: {} 3}
Where req
is the request
as serialized by the standard request serializer.
exports.req(request)
The default request
serializer. Returns an object:
1{ 2 id: 'string', // Defaults to `undefined`, unless there is an `id` property 3 // already attached to the `request` object or to the `request.info` 4 // object. Attach a synchronous function 5 // to the `request.id` that returns an identifier to have 6 // the value filled. 7 method: 'string', 8 url: 'string', // the request pathname (as per req.url in core HTTP) 9 query: 'object', // the request query (as per req.query in express or hapi) 10 params: 'object', // the request params (as per req.params in express or hapi) 11 headers: Object, // a reference to the `headers` object from the request 12 // (as per req.headers in core HTTP) 13 remoteAddress: 'string', 14 remotePort: Number, 15 raw: Object // Non-enumerable, i.e. will not be in the output, original 16 // request object. This is available for subsequent serializers 17 // to use. In cases where the `request` input already has 18 // a `raw` property this will replace the original `request.raw` 19 // property 20}
exports.res(response)
The default response
serializer. Returns an object:
1{ 2 statusCode: Number, // Response status code, will be null before headers are flushed 3 headers: Object, // The headers to be sent in the response. 4 raw: Object // Non-enumerable, i.e. will not be in the output, original 5 // response object. This is available for subsequent serializers 6 // to use. 7}
exports.wrapErrorSerializer(customSerializer)
A utility method for wrapping the default error serializer. This allows custom serializers to work with the already serialized object.
The customSerializer
accepts one parameter — the newly serialized error
object — and returns the new (or updated) error object.
exports.wrapRequestSerializer(customSerializer)
A utility method for wrapping the default request serializer. This allows custom serializers to work with the already serialized object.
The customSerializer
accepts one parameter — the newly serialized request
object — and returns the new (or updated) request object.
exports.wrapResponseSerializer(customSerializer)
A utility method for wrapping the default response serializer. This allows custom serializers to work with the already serialized object.
The customSerializer
accepts one parameter — the newly serialized response
object — and returns the new (or updated) response object.
MIT License
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
Found 4/8 approved changesets -- score normalized to 5
Reason
3 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More