bunyanloggingtemplate

1.2.5 • Public • Published

This is a custom made package that is composed with a template providing 3 custom loggers with their associated logging level for log standardization. This logger will print out more user friendly logs in your lambda's cloudwatch logs. Utilizing this logger can make structured logging easier.

When testing the package you can do npm test | bunyan -o short to see a nicer view of the logs compared to bunyans raw text style logs. I reccomend creating a layer in lambda that contains the bunyan, bunyan-aws node modules to allow you to not have to install the bunyan dependencies for each lambda.

Dependencies of this package are the following: bunyan, bunyan-aws, aws-sdk.

package contents:

const bunyan = require("bunyan");

const infoLogger = bunyan.createLogger({ name: "info log", level: "info", stream: process.stdout, /**

  • more configuration here
  • */ });

const errorLogger = bunyan.createLogger({ name: "error log", level: "error", stream: process.stdout, /**

  • more configuration here
  • */ });

const warnLogger = bunyan.createLogger({ name: "warn log", level: "warn", stream: process.stdout, /**

  • more configuration here
  • */ });

module.exports = { infoLogger, errorLogger, warnLogger, };

Readme

Keywords

none

Package Sidebar

Install

npm i bunyanloggingtemplate

Weekly Downloads

0

Version

1.2.5

License

ISC

Unpacked Size

2.6 kB

Total Files

5

Last publish

Collaborators

  • developeng234