logger-hierarchy
v0.1.2logger-hierarchy
Automatic Logging Module
Install
$ npm install logger-hierarchy
Example Usage
const logger = require('logger-hierarchy')('moduleName');
function exampleFunction() {
var log = logger(arguments);
log.printArguments() // Add at the beginning of all functions you want to log
log.message('Something normal happened')
log.error('There was a failure')
log.warning('A friendly warning over here')
log.success('Important success!')
log.finished() // Add to the end of all functions you want to log
}
exampleFunction()
Example Output:
Examples:
Async functions can be logged like this: /examples/async-example.js:
API
logger(arguments)
arguments
Arguments object of the function (JS reserved word), pass it to the logger for function name and parametters logging on the screen
(TODO: Complete API information)
License
MIT © Carlos Guerrero
npm i logger-hierarchy
Source Code
github.com/guerrerocarlos/lo...Metadata
- MIT
- >=4
- Carlos Guerrero
- released 4/26/2018