1.0.6 • Published 2 years ago
logger-v18 v1.0.6
logger for node.js
A powerful and customizable logging library to be used for internal node.js projects.
===========
Features
- print log messages with timestamp, file name, method name, line number, path or call stack
- support user-defined logging levels
- support user-defined service name and tags
- print statements in full color and font (color console)
Install
npm install --save logger-v18
Usage
Add to your code:
Import
const log = require('logger-v18');
Initialization
log.init(Options); // this needs to be done only in one file rest of the files can directly get logger.
Support Options:
Options = {
json: 'boolean', //weather to print log in json format or not. default: false
service: 'servicename', //name of the service , issue will be taged against this servicename
//and if any owner is assigned to the service issue will be reported to him
tags: [], // addtional tags to be added
level: 'level' // log level
}
Simple Example
const log = require('logger-v18');
const { logger } = log;
log.init({
json: true, service: 'service', tags: ['crons'], level: 'info',
});
logger.log('this should not be displayed');
logger.info('this should appear colored');
History
0.1.0
- Initial Logger implementation.