Noosphere Possibilities Maximized

    cloudwatch-console-logger

    1.0.0 • Public • Published

    Cloudwatch Console Logger

    Build Status Coverage Status

    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,
        enviornment: process.env.STAGE,
        prNumber: process.env.PR || 'UNDEF',
        cookies: event.headers.Cookie,
        headers: event.headers,
        hostName: event.headers.Host
      });
     
     
     
      logger.info(`Hello world`);
      
      /* 
    prints on server side only
       {
           // initial data
        awsLambdaFunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
        awsRegion: process.env.AWS_REGION,
        timeZone: process.env.TZ,
        enviornment: process.env.STAGE,
        prNumber: process.env.PR || 'UNDEF',
        cookies: event.headers.Cookie,
        headers: event.headers,
        hostName: event.headers.Host,
        // more data
        message: "Hello world"
        // and more, like line number.
       }

    Install

    npm i cloudwatch-console-logger

    DownloadsWeekly Downloads

    0

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    8.82 kB

    Total Files

    4

    Last publish

    Collaborators

    • garrettmac