diff --git a/packages/logging/logging.js b/packages/logging/logging.js index c20502496d..b6c2947075 100644 --- a/packages/logging/logging.js +++ b/packages/logging/logging.js @@ -188,23 +188,21 @@ Log.format = function (obj, options) { var appInfo = ''; if (appName) appInfo += appName; - if (originApp && originApp !== appName) appInfo += ':' + originApp; - if (appInfo) appInfo = ' [' + appInfo + ']'; + if (originApp && originApp !== appName) appInfo += ' via ' + originApp; + if (appInfo) appInfo = '[' + appInfo + '] '; var sourceInfo = (file && lineNumber) ? - ['(', (program ? program + ':' : ''), file, ':', lineNumber, ')'].join('') + ['(', (program ? program + ':' : ''), file, ':', lineNumber, ') '].join('') : ''; - if (sourceInfo && !appInfo) - sourceInfo = ' ' + sourceInfo; - var stderrIndicator = stderr ? ' (STDERR)' : ''; + var stderrIndicator = stderr ? '(STDERR) ' : ''; var metaPrefix = [ level.charAt(0).toUpperCase(), dateStamp, '-', timeStamp, - timeInexact ? '?' : '', + timeInexact ? '?' : ' ', appInfo, sourceInfo, stderrIndicator].join(''); @@ -215,7 +213,6 @@ Log.format = function (obj, options) { }; return prettify(metaPrefix, META_COLOR) - + ' ' + prettify(message, LEVEL_COLORS[level]); }; diff --git a/packages/logging/logging_test.js b/packages/logging/logging_test.js index 9766eaf2d9..2f0580a5a5 100644 --- a/packages/logging/logging_test.js +++ b/packages/logging/logging_test.js @@ -76,7 +76,7 @@ Tinytest.add("logging - format", function (test) { test.equal( Log.format({message: "message", time: time, timeInexact: true, level: level}), - level.charAt(0).toUpperCase() + "20120908-07:06:05.004? message"); + level.charAt(0).toUpperCase() + "20120908-07:06:05.004?message"); test.equal( Log.format({foo1: "bar1", foo2: "bar2", time: time, level: level}), @@ -89,7 +89,7 @@ Tinytest.add("logging - format", function (test) { // Has everything except stderr field test.equal( Log.format({message: "message", foo: "bar", time: time, level: level, file: "app.js", line:42, app: "myApp", originApp: "proxy", program: "server"}), - level.charAt(0).toUpperCase() + '20120908-07:06:05.004 [myApp:proxy](server:app.js:42) message {\"foo\":\"bar\"}'); + level.charAt(0).toUpperCase() + '20120908-07:06:05.004 [myApp via proxy] (server:app.js:42) message {\"foo\":\"bar\"}'); // stderr test.equal( @@ -102,7 +102,7 @@ Tinytest.add("logging - format", function (test) { level.charAt(0).toUpperCase() + '20120908-07:06:05.004 [app] message'); test.equal( Log.format({message: "message", time: time, level: level, app: "app", originApp: "proxy"}), - level.charAt(0).toUpperCase() + '20120908-07:06:05.004 [app:proxy] message'); + level.charAt(0).toUpperCase() + '20120908-07:06:05.004 [app via proxy] message'); // source info test.equal(