Skip to content

garrettmac/cloudwatch-console-logger

Repository files navigation

Cloudwatch Console Logger

Build Status Coverage Status

GitHub stars: GitHub license: Twitter:

Getting started

This creates a global logger variable with the option to overide the console in an aws enviornment to print objects rather than strings.

This is useful when using loggly.com

yarn add cloudwatch-console-logger

Example Usage

import CloudwatchConsoleLogger from 'cloudwatch-console-logger'
// initialize what you want to be added to each console.* or logger.* statment
 CloudwatchConsoleLogger.init({
    awsLambdaFunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
    awsRegion: process.env.AWS_REGION,
    timeZone: process.env.TZ
  });



  logger.info('Hello world');
  
  /* 
prints on server side only
   {
       // initial data
    awsLambdaFunctionName: "myLambdaFunction",
    awsRegion: "some region",
    timeZone: "some time zone",
    // more data
    message: "Hello world"
   }

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published