Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue 4337 #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ var DEFAULT = require('./defaults');
module.exports = function _wrap(logger, options) {

// Make base logger callable (debug)
var _CallableLogger = write(logger.debug, 'debug', options);
var _CallableLogger = write(logger, logger.debug, 'debug', options);

// Mix-in log methods, but run `write`
// on their arguments to improve the readability
// of log output.
DEFAULT.METHODS.forEach(function(logAt) {
_CallableLogger[logAt] = write(logger[logAt], logAt, options);
_CallableLogger[logAt] = write(logger, logger[logAt], logAt, options);
});

return _CallableLogger;
Expand Down
6 changes: 3 additions & 3 deletions lib/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var IS_NODE_8_OR_NEWER = semver.satisfies(semver.clean(process.version), '8');
* @api private
*/

module.exports = function(logFn, logAt, options) {
module.exports = function(loggerObj, logFn, logAt, options) {
return function _writeLogToConsole() {

// Check `options.level` against logAt
Expand All @@ -44,7 +44,7 @@ module.exports = function(logFn, logAt, options) {
//
// If `options.inspect` is disabled, just call the log fn normally
if (!options.inspect) {
return logFn.apply(logFn, args);
return logFn.apply(loggerObj, args);
}
/////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -87,6 +87,6 @@ module.exports = function(logFn, logAt, options) {
var str = prefixStr + util.format.apply(util, pieces);

// Call log fn
return logFn.apply(logFn, [str]);
return logFn.apply(loggerObj, [str]);
};
};