A simple logging module that sports 5 levels of logging:
- trace
- debug
- info
- warn
- error
The level shown in stdout is determined by the rumor
env var. Set it,
and everything of that level or higher will be shown. It will default to
info.
Output is colored / formatted (using chalk), and will show level, namespace, date and message:
info rumor 2016-11-04 12:29:06 infowarn rumor 2016-11-04 12:29:06 warnerror rumor 2016-11-04 12:29:06 error
The namespace will default to the current package name, if nothing is given.
Install
npm install --save rumor
Usage
const rumor = 'mymodule'; ;rumor; // debug mymodule 2016-11-04 12:29:06 This is a debugging message rumor; // info my namespace 2016-11-04 12:29:06 This is an info message
rumor will expand objects and arrays using util.inspect, to an arbitrary depth.
All of the methods return the message object, which can be used to log an object inside a promise chain and continue:
return Promise ;