Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/pino-std-serializers

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/pino-std-serializers

Stub TypeScript definitions entry for pino-std-serializers, which provides its own types definitions

  • 4.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @types/pino-std-serializers?

@types/pino-std-serializers provides TypeScript type definitions for the pino-std-serializers package, which is used to serialize standard Node.js objects such as HTTP requests, responses, and errors for logging purposes.

What are @types/pino-std-serializers's main functionalities?

HTTP Request Serializer

This feature allows you to serialize HTTP request objects for logging. The `asReqValue` function converts the request object into a format suitable for logging.

const pino = require('pino');
const { asReqValue } = require('pino-std-serializers');

const logger = pino({
  serializers: {
    req: asReqValue
  }
});

const req = { method: 'GET', url: '/test', headers: { host: 'localhost' } };
logger.info({ req }, 'Request received');

HTTP Response Serializer

This feature allows you to serialize HTTP response objects for logging. The `asResValue` function converts the response object into a format suitable for logging.

const pino = require('pino');
const { asResValue } = require('pino-std-serializers');

const logger = pino({
  serializers: {
    res: asResValue
  }
});

const res = { statusCode: 200, headers: { 'content-type': 'application/json' } };
logger.info({ res }, 'Response sent');

Error Serializer

This feature allows you to serialize error objects for logging. The `asErrValue` function converts the error object into a format suitable for logging.

const pino = require('pino');
const { asErrValue } = require('pino-std-serializers');

const logger = pino({
  serializers: {
    err: asErrValue
  }
});

const error = new Error('Something went wrong');
logger.error({ err: error }, 'Error occurred');

Other packages similar to @types/pino-std-serializers

FAQs

Package last updated on 31 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc