X-Git-Url: https://git.r.bdr.sh/rbdr/cologne/blobdiff_plain/7f4b2a023bda5dcf9ea830b95b88bceefb331dbd..3a0fbfeb0f3ad2db91b6b4dbad7a3757081e2485:/lib/loggers/file.js?ds=sidebyside diff --git a/lib/loggers/file.js b/lib/loggers/file.js index 0512ace..0d60acd 100644 --- a/lib/loggers/file.js +++ b/lib/loggers/file.js @@ -12,7 +12,7 @@ Class(Cobalt.Logger, 'File')({ } } - this._stream = fs.createWriteStream(this.file); + this._stream = fs.createWriteStream(this.file, {flags: 'a'}); }, log : function () { @@ -22,11 +22,7 @@ Class(Cobalt.Logger, 'File')({ // We're not formatting objects for now. if (!arguments[i].__skipConsole && !arguments[i].message.__skipConsole) { - if (typeof arguments[i].message === 'object') { - message.push(arguments[i].message); - } else { - message.push(this.format(arguments[i])); - } + message.push(this.format(arguments[i])); if (!severity) { severity = arguments[i]._level } @@ -40,10 +36,13 @@ Class(Cobalt.Logger, 'File')({ format : function (logObject) { if (this.formatter) { + if (typeof logObject.message === 'object') { + return logObject.message; + } return this.formatter.format(logObject, this.formatterOpts); } - return logObject.message; + return Cobalt.stringify(logObject); } } });