Skip to content

ericlin716/adenovo-utils

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Adenovo utils

Util methods for Adenovo.

Usage

Basic log:

const {debugLog} = require('adenovo-utils');

debugLog('for debug usage');  // [debug] for debug usage

For ELK duration logs:

const {durationLog, startLog, endLog} = require('../src/index');

const event = {foo: 'bar', hello: 'world'}; // your event object

durationLog('test')(event); // Lambda Event End: {"foo":"bar","hello":"world"}

startLog(event); // Lambda Event Start: {"foo":"bar","hello":"world"}

endLog(event); // Lambda Event End: {"foo":"bar","hello":"world"}

For ELK action logs (basic):

const {actionLog} = require('../src/index');

const event = {foo: 'bar', hello: 'world'};
const payload = {group: 'mygroup', method: 'paySomething', data: event}; // optional: memberId

actionLog('handler')('debug')(payload); // DEV,debug,handler,mygroup,paySomething,{"foo":"bar","hello":"world"}

For ELK action logs (more specific):

Includes:

  • handlerLog(logLevel: string)(payload: object)
  • handlerLogDebug(payload)
  • handlerLogInfo
  • handlerLogWarning
  • handlerLogError
  • modelLog(logLevel: string)(payload: object)
  • modelLogDebug(payload)
  • modelLogInfo
  • modelLogWarning
  • modelLogError

For example:

const {handlerLog, modelLog, handlerLogDebug, modelLogWarning} = require('../src/index');

const event = {foo: 'bar'};
const payload = {group: 'mygroup', method: 'paySomething', data: event};

handlerLog('hello')(payload); // DEV,hello,handler,mygroup,paySomething,{"foo":"bar"}
modelLog('world')(payload); // DEV,world,model,mygroup,paySomething,{"foo":"bar"}
handlerLogDebug(payload); // DEV,debug,handler,mygroup,paySomething,{"foo":"bar"}
modelLogWarning(payload); // DEV,warning,model,mygroup,paySomething,{"foo":"bar"}

About

for Adenovo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%