Name: lib-logger
Owner: Namshi
Description: null
Created: 2018-04-03 11:13:31.0
Updated: 2018-05-09 11:19:26.0
Pushed: 2018-05-10 04:48:16.0
Homepage: null
Size: 15
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Library that simplifies the way we log. It eases migration from native console.log to other log libraries. Current release wrapped winston logger but more loggers can be supported later.
Install it through: npm i lib-logger
const log = require('lib-logger');
log.debug("This is a debug message!");
log.info("This is an info message");
To ease migrating from console.log to lib-logger, the library supports receiving a number of arguments (should be limited) that are not wrapped in a json object. The library will parse and format it as follows:
example: log.error('Shipment Number', 1234, “could not be created”, new Error('Error while bla bla'), { name: 'Test Name', locale: 'en', country: 'ae'});
Output:
message: 'Shipment Number, 1234, could not be created, Error: Error while bla bla' it's
context object: {
stack: "Error while bla bla @FileName ..... stacktrace',
statusCode: 500, // default value if no code provided in the error object
name: 'Test Name',
locale: 'en',
country: 'ae',
}