YUKI Hiroshi
null+****@clear*****
Thu Nov 1 18:57:44 JST 2012
YUKI Hiroshi 2012-11-01 18:57:44 +0900 (Thu, 01 Nov 2012) New Revision: b0aba030d4ee98c6215a16a64451c10c2467eb75 https://github.com/groonga/gcs/commit/b0aba030d4ee98c6215a16a64451c10c2467eb75 Log: Output multiline log messages with small indent Modified files: lib/logger.js Modified: lib/logger.js (+7 -8) =================================================================== --- lib/logger.js 2012-11-01 18:53:18 +0900 (3738fee) +++ lib/logger.js 2012-11-01 18:57:44 +0900 (8f898d1) @@ -33,15 +33,14 @@ Logger.prototype = { timezoneOffset; }, log: function(message) { - var timestamp = '[' + this.getTimestamp() + '] '; - var indent = timestamp.replace(/./g, ' '); - + var timestamp = '[' + this.getTimestamp() + ']'; message = message.split('\n'); - this.stream.write(timestamp + message[0] + '\n'); - - if (message.length > 1) { - message.slice(1).forEach(function(line) { - this.stream.write(indent + line + '\n'); + if (message.length == 1) { + this.stream.write(timestamp + ' ' + message[0] + '\n'); + } else { + this.stream.write(timestamp + '\n'); + message.forEach(function(line) { + this.stream.write(' ' + line + '\n'); }, this); } } -------------- next part -------------- HTML����������������������������... 下載