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

lambda-le-logger

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

lambda-le-logger

A way to send logs to the Logentries service, even from an AWS Lambda function.

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Lambda-Le-Logger

A way to send logs to the Logentries service, even from an AWS Lambda function.

Basic Usage

To use this, simply add the following to your code:

// Up with your other require statements, add this:
var logger = require('lambda-le-logger');

// ... and then down where your code actually starts doing things, add this:
logger.initLogger();

// After that, you can call the log/info/warn/error methods at any time:
logger.info('Starting...');

Make sure you call initLogger() on each execution of your code, before you start sending logs to Logentries.

Methods

initLogger()

Initialize the (internal) logger instance. Call this before sending log data.

log(message) / info(message) / warn(message) / error(message)

Send log data to Logentries.

registerCompletionCallback(callback)

Register a function to be called ONCE as soon as the last of the currently-pending attempts at sending a log message has completed (successfully or not). If there are currently no pending messages, the callback will be called immediately. No parameters will be sent to the callback you provide.

This can be helpful to use just before calling the main callback function of your lambda code, to allow the sending of logs to Logentries to complete before your lambda function terminates. For example:

logFunctions.registerCompletionCallback(function() {
  mainCallback(null, results);
});

If you don't do this, some of your logs might not make it to Logentries (which is one of the main reasons I wrote this library).

License

This code is made available under the MIT license.

Keywords

FAQs

Package last updated on 22 Dec 2015

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