moh-logger
v0.1.1
Published
Logger for moh
Downloads
2
Readme
moh-logger
Logger for moh
Features
- Simple method to log info
debug
: with blue colors used todebug
infosinfo
: with green colors used to loginfo
level messageswarn
: with yellow colors used to logwarn
level messageserror
: with red colors used to logerror
level messages
- Easy add extra infos into logs and beautifully managed
- pass extra object as the second paramter eg:
info('Info message', { someKey: 'someData' })
- pass extra object as the second paramter eg:
- Same method for
debug
and log debug info in non-development
environmentdebug
module is used only indevelopment
/ null environment- log with
debug
level used in non-development environment
- Easy log errors with directly pass the error object
- eg:
error(new Error('An Error'))
- eg:
- Remove redundancy stack info in error logs
- remove all infos from
node_modules
- remove all infos with out path info eg:
emitOne
,process.emit
- remove all infos from
Usage:
const debug = require('moh-logger').debug('namespace')
const { info, warn, error } = require('moh-logger')
debug('Debug message')
info('Info message')
info('Info message', { someKey: 'someData' })
warn('Warn message')
error('Error message')
error(new Error('My Error'))
Output
development Env
staging Env
TODO:
- [ ] Easy log request steam with directly pass the stream
- eg:
info(req)
- eg:
- [ ] Easy log response steam with directly pass the stream
- eg:
info(res)
- eg:
- [ ] Add feature save logs into files
- [ ] Add feature save logs into Elastic DB
- [ ] Add configuration to customize
- Target to save the logs
- Level to log
- Infos to log