captains-log
Advanced tools
Comparing version 0.11.10 to 0.11.11
@@ -15,5 +15,10 @@ /** | ||
//////////////////////////////////////////////////////////// | ||
// Backwards compatibility: | ||
// (should always be true going forward) | ||
// | ||
// Whether to use additional `inspect` logic | ||
// (if false- just do exactly what `console.log` would do) | ||
inspect: true, | ||
//////////////////////////////////////////////////////////// | ||
@@ -20,0 +25,0 @@ logLevels: { |
@@ -5,4 +5,4 @@ /** | ||
var _ = require('lodash'), | ||
util = require('util'); | ||
var _ = require('lodash'); | ||
var util = require('util'); | ||
@@ -37,9 +37,10 @@ | ||
// First, prepend the log prefix to the first argument | ||
var prefixStr = (options.prefixes && options.prefixes[logAt]) || ''; | ||
if (prefixStr) { | ||
args[0] = args[0] || ''; | ||
} | ||
// TODO: do this here so prefixes still work when `inspect`===false | ||
///////////////////////////////////////////////////////////////// | ||
// For backwards-compatibility: | ||
// (options.inspect should always be true going forward) | ||
// | ||
// Note that prefixes and other options will not work with | ||
// `inspect===false`. New features will also not support | ||
// inspect:false. | ||
// | ||
// If `options.inspect` is disabled, just call the log fn normally | ||
@@ -49,7 +50,9 @@ if (!options.inspect) { | ||
} | ||
///////////////////////////////////////////////////////////////// | ||
// Compose `str` of all the arguments | ||
// (include the appropriate prefix if specified) | ||
// For reference on the following impl, see: | ||
// https://github.com/defunctzombie/node-util/blob/master/util.js#L22 | ||
// Combine the arguments passed into the log fn | ||
var pieces = []; | ||
var str = prefixStr; | ||
_.each(arguments, function(arg) { | ||
@@ -69,12 +72,10 @@ | ||
// Probably shouldn't do this, actually. | ||
// if (typeof arg === 'function') { | ||
// pieces.push(arg.valueOf()); | ||
// return; | ||
// } | ||
pieces.push(arg); | ||
}); | ||
str += pieces.join(' '); | ||
// Compose `str` of all the arguments | ||
// (include the appropriate prefix if specified) | ||
var prefixStr = (options.prefixes && options.prefixes[logAt]) || ''; | ||
var str = prefixStr + util.format.apply(util, pieces); | ||
// Call log fn | ||
@@ -81,0 +82,0 @@ return logFn.apply(logFn, [str]); |
{ | ||
"name": "captains-log", | ||
"version": "0.11.10", | ||
"version": "0.11.11", | ||
"description": "Simple wrapper around Winston to allow for declarative configuaration", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36262
1024