You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

pino-lambda

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pino-lambda

Pino destination formatter for AWS Lambda

4.4.1
latest
Source
npmnpm
Version published
Weekly downloads
192K
-27.53%
Maintainers
2
Weekly downloads
 
Created

What is pino-lambda?

pino-lambda is a logging library designed to integrate the Pino logger with AWS Lambda functions. It provides a streamlined way to handle logging in serverless environments, ensuring that logs are formatted and managed efficiently.

What are pino-lambda's main functionalities?

Integration with AWS Lambda

This feature allows you to wrap your AWS Lambda handler with pino-lambda, enabling structured logging using Pino within the Lambda environment. The code sample demonstrates how to use pino-lambda to log an informational message within a Lambda function.

const pinoLambda = require('pino-lambda');

exports.handler = pinoLambda((event, context) => {
  context.log.info('This is an info log');
  return {
    statusCode: 200,
    body: JSON.stringify({ message: 'Hello from Lambda!' })
  };
});

Custom Log Levels

pino-lambda supports various log levels such as info, warn, and error. This feature allows developers to log messages at different severity levels, which can be useful for debugging and monitoring. The code sample shows how to log warning and error messages.

const pinoLambda = require('pino-lambda');

exports.handler = pinoLambda((event, context) => {
  context.log.warn('This is a warning log');
  context.log.error('This is an error log');
  return {
    statusCode: 200,
    body: JSON.stringify({ message: 'Check the logs for warnings and errors' })
  };
});

Other packages similar to pino-lambda

Keywords

pino

FAQs

Package last updated on 23 Oct 2024

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.