mirror of https://github.com/thumbsup/thumbsup
New --log option to print a full text log with different verbosity levels
parent
06ecd2edad
commit
47a924883e
@ -0,0 +1,16 @@
|
||||
|
||||
exports.init = (logLevel) => {
|
||||
// enable particular debug() prefixes
|
||||
if (logLevel === 'trace') process.env['DEBUG'] = '*'
|
||||
if (logLevel === 'debug') process.env['DEBUG'] = 'thumbsup:error,thumbsup:warn,thumbsup:info,thumbsup:debug'
|
||||
if (logLevel === 'info') process.env['DEBUG'] = 'thumbsup:error,thumbsup:warn,thumbsup:info'
|
||||
|
||||
// when running in text-mode, make sure all console.log() calls go through debug()
|
||||
// don't touch them in normal-mode, since it would affect Listr's dnyamic rendering
|
||||
if (typeof logLevel === 'string') {
|
||||
console.log = require('debug')('thumbsup:info')
|
||||
console.info = require('debug')('thumbsup:info')
|
||||
console.warn = require('debug')('thumbsup:warn')
|
||||
console.error = require('debug')('thumbsup:error')
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue