{"name":"pino-std-serializers","version":"7.1.0","keywords":["pino","logging"],"author":{"name":"James Sumners","email":"james.sumners@gmail.com"},"license":"MIT","_id":"pino-std-serializers@7.1.0","maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"},{"name":"jsumners","email":"james.sumners@gmail.com"},{"name":"watson","email":"w@tson.dk"}],"homepage":"https://github.com/pinojs/pino-std-serializers#readme","bugs":{"url":"https://github.com/pinojs/pino-std-serializers/issues"},"tsd":{"directory":"test/types"},"dist":{"shasum":"a7b0cd65225f29e92540e7853bd73b07479893fc","tarball":"http://registry-npm.ywwl.com/pino-std-serializers/download/pino-std-serializers-7.1.0.tgz","fileCount":21,"integrity":"sha512-BndPH67/JxGExRgiX1dX0w1FvZck5Wa4aal9198SrRhZjH3GxKQUKIBnYJTdj2HDN3UQAS06HlfcSbQj2OHmaw==","signatures":[{"sig":"MEQCICHle9yUInVjgcJC2uwwBZ9yErWFNyJJiwpWyhBgEc8xAiBmf2y3YztD4wIsKiFuVmVbMdCOoc9NjomDy+vydZ2hMQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":54009,"size":10180,"noattachment":false,"key":"/pino-std-serializers/-/pino-std-serializers-7.1.0.tgz"},"main":"index.js","type":"commonjs","types":"index.d.ts","gitHead":"d32587d2006fd7697f04fe91dcb07830807719fe","scripts":{"lint":"eslint .","test":"borp -p 'test/**/*.js'","lint-ci":"eslint --max-warnings=0 .","test-ci":"borp --coverage -p 'test/**/*.js'","lint:fix":"eslint --fix .","test-types":"tsc && tsd"},"_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"repository":{"url":"git+ssh://git@github.com/pinojs/pino-std-serializers.git","type":"git"},"_npmVersion":"11.6.2","description":"A collection of standard object serializers for Pino","directories":{},"_nodeVersion":"24.12.0","_hasShrinkwrap":false,"devDependencies":{"tsd":"^0.33.0","borp":"^0.21.0","eslint":"^9.39.2","typescript":"~5.9.3","@types/node":"^25.0.3","neostandard":"^0.12.2","@matteo.collina/tspl":"^0.2.0"},"_npmOperationalInternal":{"tmp":"tmp/pino-std-serializers_7.1.0_1768308619458_0.8655769236628315","host":"s3://npm-registry-packages-npm-production"},"readme":"# pino-std-serializers&nbsp;&nbsp;[![CI](https://github.com/pinojs/pino-std-serializers/workflows/CI/badge.svg)](https://github.com/pinojs/pino-std-serializers/actions?query=workflow%3ACI)\n\nThis module provides a set of standard object serializers for the\n[Pino](https://getpino.io) logger.\n\n## Serializers\n\n### `exports.err(error)`\nSerializes an `Error` like object. Returns an object:\n\n```js\n{\n  type: 'string', // The name of the object's constructor.\n  message: 'string', // The supplied error message.\n  stack: 'string', // The stack when the error was generated.\n  raw: Error  // Non-enumerable, i.e. will not be in the output, original\n              // Error object. This is available for subsequent serializers\n              // to use.\n  [...any additional Enumerable property the original Error had]\n}\n```\n\nAny other extra properties, e.g. `statusCode`, that have been attached to the\nobject will also be present on the serialized object.\n\nIf the error object has a [`cause`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/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.\n\nExample:\n\n```js\nconst serializer = require('pino-std-serializers').err;\n\nconst innerError = new Error(\"inner error\");\ninnerError.isInner = true;\nconst outerError = new Error(\"outer error\", { cause: innerError });\nouterError.isInner = false;\n\nconst serialized = serializer(outerError);\n/* Result:\n{\n  \"type\": \"Error\",\n  \"message\": \"outer error: inner error\",\n  \"isInner\": false,\n  \"stack\": \"Error: outer error\n        at <...omitted..>\n    caused by: Error: inner error\n        at <...omitted..>\n}\n */\n```\n\n### `exports.errWithCause(error)`\nSerializes an `Error` like object, including any `error.cause`. Returns an object:\n\n```js\n{\n  type: 'string', // The name of the object's constructor.\n  message: 'string', // The supplied error message.\n  stack: 'string', // The stack when the error was generated.\n  cause?: Error, // If the original error had an error.cause, it will be serialized here\n  raw: Error  // Non-enumerable, i.e. will not be in the output, original\n              // Error object. This is available for subsequent serializers\n              // to use.\n  [...any additional Enumerable property the original Error had]\n}\n```\n\nAny other extra properties, e.g. `statusCode`, that have been attached to the object will also be present on the serialized object.\n\nExample:\n```javascript\nconst serializer = require('pino-std-serializers').errWithCause;\n\nconst innerError = new Error(\"inner error\");\ninnerError.isInner = true;\nconst outerError = new Error(\"outer error\", { cause: innerError });\nouterError.isInner = false;\n\nconst serialized = serializer(outerError);\n/* Result:\n{\n  \"type\": \"Error\",\n  \"message\": \"outer error\",\n  \"isInner\": false,\n  \"stack\": \"Error: outer error\n    at <...omitted..>\",\n  \"cause\": {\n    \"type\": \"Error\",\n    \"message\": \"inner error\",\n    \"isInner\": true,\n    \"stack\": \"Error: inner error\n      at <...omitted..>\"\n  },\n}\n */\n```\n\n### `exports.mapHttpResponse(response)`\nUsed internally by Pino for general response logging. Returns an object:\n\n```js\n{\n  res: {}\n}\n```\n\nWhere `res` is the `response` as serialized by the standard response serializer.\n\n### `exports.mapHttpRequest(request)`\nUsed internall by Pino for general request logging. Returns an object:\n\n```js\n{\n  req: {}\n}\n```\n\nWhere `req` is the `request` as serialized by the standard request serializer.\n\n### `exports.req(request)`\nThe default `request` serializer. Returns an object:\n\n```js\n{\n  id: 'string', // Defaults to `undefined`, unless there is an `id` property\n                // already attached to the `request` object or to the `request.info`\n                // object. Attach a synchronous function\n                // to the `request.id` that returns an identifier to have\n                // the value filled.\n  method: 'string',\n  url: 'string', // the request pathname (as per req.url in core HTTP)\n  query: 'object', // the request query (as per req.query in express or hapi)\n  params: 'object', // the request params (as per req.params in express or hapi)\n  headers: Object, // a reference to the `headers` object from the request\n                   // (as per req.headers in core HTTP)\n  remoteAddress: 'string',\n  remotePort: Number,\n  raw: Object // Non-enumerable, i.e. will not be in the output, original\n              // request object. This is available for subsequent serializers\n              // to use. In cases where the `request` input already has\n              // a `raw` property this will replace the original `request.raw`\n              // property\n}\n```\n\n### `exports.res(response)`\nThe default `response` serializer. Returns an object:\n\n```js\n{\n  statusCode: Number, // Response status code, will be null before headers are flushed\n  headers: Object, // The headers to be sent in the response.\n  raw: Object // Non-enumerable, i.e. will not be in the output, original\n              // response object. This is available for subsequent serializers\n              // to use.\n}\n```\n\n### `exports.wrapErrorSerializer(customSerializer)`\nA utility method for wrapping the default error serializer. This allows\ncustom serializers to work with the already serialized object.\n\nThe `customSerializer` accepts one parameter — the newly serialized error\nobject — and returns the new (or updated) error object.\n\n### `exports.wrapRequestSerializer(customSerializer)`\nA utility method for wrapping the default request serializer. This allows\ncustom serializers to work with the already serialized object.\n\nThe `customSerializer` accepts one parameter — the newly serialized request\nobject — and returns the new (or updated) request object.\n\n### `exports.wrapResponseSerializer(customSerializer)`\nA utility method for wrapping the default response serializer. This allows\ncustom serializers to work with the already serialized object.\n\nThe `customSerializer` accepts one parameter — the newly serialized response\nobject — and returns the new (or updated) response object.\n\n## License\n\nMIT License\n","publish_time":1768308619626,"_cnpm_publish_time":1768308619626,"dist-tags":{"latest":"7.1.0"}}