diff options
Diffstat (limited to 'node_modules/fancy-log/index.js')
-rw-r--r-- | node_modules/fancy-log/index.js | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/node_modules/fancy-log/index.js b/node_modules/fancy-log/index.js index 12df5c34c..c78eb45c8 100644 --- a/node_modules/fancy-log/index.js +++ b/node_modules/fancy-log/index.js @@ -2,11 +2,32 @@ /* Initial code from https://github.com/gulpjs/gulp-util/blob/v3.0.6/lib/log.js */ -var chalk = require('chalk'); +var gray = require('ansi-gray'); var timestamp = require('time-stamp'); +var supportsColor = require('color-support'); + +function hasFlag(flag) { + return (process.argv.indexOf('--' + flag) !== -1); +} + +function addColor(str) { + if (hasFlag('no-color')) { + return str; + } + + if (hasFlag('color')) { + return gray(str); + } + + if (supportsColor()) { + return gray(str); + } + + return str; +} function getTimestamp(){ - return '['+chalk.grey(timestamp('HH:mm:ss'))+']'; + return '['+addColor(timestamp('HH:mm:ss'))+']'; } function log(){ |