Permalink
Browse files

[minor] Dont allow multi-line values for conditional returns

  • Loading branch information...
1 parent 94c6518 commit 3220dd9e5c9e6a98a2854ca30ec5e6dfce2d55ce @indexzero indexzero committed Jul 8, 2012
Showing with 10 additions and 8 deletions.
  1. +10 −8 lib/winston/common.js
View
18 lib/winston/common.js
@@ -134,6 +134,7 @@ exports.log = function (options) {
if (typeof meta !== 'object' && meta != null) {
meta = { meta: meta };
}
+
output = exports.clone(meta) || {};
output.level = options.level;
output.message = options.message;
@@ -142,14 +143,15 @@ exports.log = function (options) {
output.timestamp = timestamp;
}
- return typeof options.stringify === 'function'
- ? options.stringify(output)
- : JSON.stringify(output, function (key, value) {
- if (value instanceof Buffer) {
- return value.toString('base64');
- }
- return value;
- });
+ if (typeof options.stringify === 'function') {
+ return options.stringify(output);
+ }
+
+ return JSON.stringify(output, function (key, value) {
+ return value instanceof Buffer
+ ? value.toString('base64')
+ : value;
+ });
}
output = timestamp ? timestamp + ' - ' : '';

0 comments on commit 3220dd9

Please sign in to comment.