Prepends handy information before your logs as you wish (timestamp, callsite, loglevel).
npm install superconsole__Note__ : Mostly a fork of console-trace created by Learnboost with more options.
Extends the native Node.JS console object to prefix logging functions
with the CallSite information, timestamp and log level.
To read more about runtime stack trace introspection you can refer to this
article.
$ npm install superconsole
``javascript`
require('superconsole')([options])
* __callsite__ - (Boolean: defaults to false) prepend the callsite info even without accessing methods from the t or traced getters.Boolean
* __level__ - ( : defaults to false) prepend the log level to the logBoolean
* __timestamp__ - ( : defaults to false) prepend the ISO Date to the logString
* __logLevel__ - ( : defaults to "debug") call to console[level] under logLevel will be skippedString
* __cwd__ - (: defaults to process.cwd()) the path that will be stripped from the callsite infoBoolean|Object
* __colors__ - (: defaults to true) terminal colors support flag or a custom color objectBoolean
* __right__ - (: defaults to false) callsite alignment flag, when true prints infos on the right
`javascript`
require('superconsole')
You can add the t or traced getter to your calls to obtain a stacktrace:
`js`
console.t.log('a');
console.traced.log('a');
Or:
`js
require('superconsole')({
callsite: true,
level : true,
timestamp : true,
logLevel : 'info'
})
``
* Guillermo Rauch
* Kilian Ciuffolo
* Nicholas Manousos
* Remy Loubradou