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
11
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 on AWS SQS

1.0.4
latest
npm
Version published
Weekly downloads
8
33.33%
Maintainers
11
Weekly downloads
 
Created
Source

wmawslog-js

A simple lib to send logs to AWS SQS from applications.

How to use

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

exports.handler = async (event, context) => {
    // configure
    log.init({ app: 'lambdaTest', env: 'prd', level: 'warn', queue: 'https://sqs.us-east-1.amazonaws.com/{{account_id}}/{{queue_name}}' });

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

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

Log level hierarchy

fatalerrorwarninfodebugtrace
fatalxxxxxx
errorxxxxx
warnxxxx
infoxxx
debugxx
tracex

.init()

Required.

ParamNameDescriptionOptionsDefaultRequired
appApplication NameUsed for group logsn/an/atrue
envEnvironmentUsed for group logsdev, hml, azl, prdhmlfalse
levelLog LevelMinimun level to be loggedfatal, error, warn, info, debug, tracewarnfalse
queueQueue urlAWS SQS Queue urln/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 23 Mar 2023

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