Skip to content

Commit

Permalink
[TIMOB-18727] direct warnings to stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
Feon Sua authored and Feon Sua committed Apr 21, 2015
1 parent 5573836 commit 951c466
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/logger.js
Expand Up @@ -120,11 +120,19 @@ consoul.log = function (level, msg, meta, callback) {

this.colorize || (msg = msg.stripColors);

if (this.colorize) {
if (level === 'warn') {
msg = msg.stripColors.yellow;
} else if (level === 'error') {
msg = msg.stripColors.red;
}
}

var output = common.log({
colorize: true,
json: this.json,
level: level,
message: level == 'error' && this.colorize ? msg.stripColors.red : msg,
message: msg,
meta: meta,
stringify: this.stringify,
timestamp: this.timestamp,
Expand All @@ -136,7 +144,7 @@ consoul.log = function (level, msg, meta, callback) {
output = output.substring(2);
}

if (level === 'error' || level === 'debug') {
if (level === 'error' || level === 'warn' || level === 'debug') {
console.error(output);
} else {
console.log(output);
Expand Down

0 comments on commit 951c466

Please sign in to comment.