@smarterservices/smarter-logging
v0.0.3
Published
Sends logs to papertrail
Downloads
18
Keywords
Readme
SmarterLogging
Unified logging package for back end (front end coming soon)
Installing
Make sure you have an NPM token from smarterservices and then just do an npm install
npm install @smarterservices/smarter-logging
Usage
At the start of your application
const logger = require('@smarterservices/smarter-logging');
// 1st param is Program Name
// 2nd param is an object containing labels for the application
logger.init('TestLogging', { A_LABEL: 'Don\'t Label Me' });
To send a message
// 1st Param label
// 2nd Param Message
// 3rd Param Object you want to log(optional)
logger.info(logger.labels.A_LABEL, 'hello this is a message', { hi: "d it" });
Logging different severities
logger.warn(logger.labels.A_LABEL, 'hello this is a message', { hi: "d it" });
logger.error(logger.labels.A_LABEL, 'hello this is a message', { hi: "d it" });
logger.info(logger.labels.A_LABEL, 'hello this is a message', { hi: "d it" });
logger.debug(logger.labels.A_LABEL, 'hello this is a message', { hi: "d it" });