New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lambda-log

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lambda-log

Basic logging mechanism for Node 6.10+ Lambda Functions

  • 3.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
20K
decreased by-52.31%
Maintainers
1
Weekly downloads
 
Created
Source

lambda-log

npm npm David GitHub Workflow Status Code Climate coverage license Code Climate maintainability CodeFactor Grade Snyk Vulnerabilities for npm package

A Node.js package to facilitate and enforce logging standards from processes and applications running within Lambda Functions, various AWS Services, and wherever JSON logs are desired. Lambda Log formats your log messages as JSON for simple parsing and filtering within tools such as CloudWatch Logs. Supports Node 10+.

This module is not just for Lambda! You can use this is many different environments that support reading JSON from logs. While the name remains lambda-log, it's really a universal JSON logger.

Why another lambda logger? There are others out there, but seemed to be convoluted, included more functionality than needed, not maintained, or not configurable enough. I created lambda-log to include the important functionality from other loggers, but still keeping it simple with minimal dependencies.

Features

Anyone can log JSON to the console, but with Lambda Log you also get:

  • Metadata and tags that may be set globally or individually for each log message.
  • Error and Error-like objects logged include stacktraces in the metadata automatically.
  • Each log message emits an event to allow third-party integration.
  • Pluggable and customizable by extending the LambdaLog class.
  • Pretty-printing of the JSON log message in dev mode.
  • Well documented, commented, and maintained source code.
  • Over 1 million downloads and more than 20k weekly downloads.
  • Small footprint.
New in Version 3.0.0

Version 3.0.0 of Lambda Log brings a bunch of changes, new features, and a new website.

Broad Changes:

  • Refactor all code to meet new ESLint specifications and to stay up-to-date with newer ecmascript specifications.
  • New website with better documentation.
  • Tests are now using Jest instead of Mocha.
  • Switched from TravisCI to Github Actions.

New Features:

  • Added levelKey configuration option to be able to change the key name for log levels.
  • Added messageKey configuration option to be able to change the key name for log messages.
  • Added tagsKey configuration option to be able to change the key name for tags.
  • Added ability to remove log level and tags from the outputted log JSON.
  • Added addLevel() method to quickly add a custom log level to an instance of LambdaLog.
  • Tags can now be functions that return a dynamic tag for log messages.
  • Tags now have variable support.
  • Tags that are null, undefined or "" are now removed from the tags array.
  • Metadata that contains Error objects are now automatically converted to a plain object.

Breaking Changes:

  • All of the private properties of both the LambdaLog and LogMessage classes are stored using Symbols. This may break some advanced uses of Lambda Log from version 2.
  • Tags no longer contain any default, built-in tags and are empty by default.
  • Some of the properties of LogMessage have been moved from the constructor to their own getter functions.

Documentation

Documentation for Lambda Log has moved to our new website.

Tests

See Development Documentation.

Contributing

See Contributing Documentation.

License

MIT License. See License in the repository.

Keywords

FAQs

Package last updated on 12 Apr 2021

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