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

@webmotors/wmawslog-js

Package Overview
Dependencies
Maintainers
5
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webmotors/wmawslog-js

Lib to log AWS Lambda logs on AWS SQS

1.0.2
npm
Version published
Weekly downloads
0
Maintainers
5
Weekly downloads
 
Created
Source

wmawslog-js

A simple lib to send logs to AWS SQS from Lambda functions.

How to use

const log = require('@webmotors/wmawslog-js');

exports.handler = async (event, context) => {
    // configure
    log.init({ app: 'lambdaTest', env: 'prd', level: 'warn', context });

    await log.info('Function started...');

    try {
     /**
      * code to be logged
      */
    } catch (err) {
        await log.error(err);
    }
};

Log level hierarchy

fatalerrorwarninfodebugtrace
fatalx
errorxx
warnxxx
infoxxxx
debugxxxxx
tracexxxxxx

.init()

Required.

ParamNameDescriptionOptionsDefaultRequired
appApplication NameUsed for group logsn/an/atrue
envEnvironmentUsed for group logshml, azl, prdhmlfalse
levelLog LevelMinimun level to be loggedfatal, error, warn, info, debug, tracewarnfalse
contextLambda contextLambda context to extract AWS account IDn/an/atrue

.fatal(message)

Logs a fatal error. Message is required (can be a string, object, error stack, etc...);

.error(message)

Logs a error. Message is required (can be a string, object, error stack, etc...);

.warn(message)

Logs a warn. Message is required (can be a string, object, error stack, etc...);

.info(message)

Logs a info. Message is required (can be a string, object, error stack, etc...);

.debug(message)

Logs a debug. Message is required (can be a string, object, error stack, etc...);

.trace(message)

Logs a trace. Message is required (can be a string, object, error stack, etc...);

FAQs

Package last updated on 09 Nov 2020

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