Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
Use common.format inside Logger#log
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed Jul 27, 2012
1 parent d546f75 commit a5950cb
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions lib/winston/logger.js
Expand Up @@ -120,23 +120,25 @@ Logger.prototype.extend = function (target) {
// #### @callback {function} Continuation to respond to when complete.
// Core logging method exposed to Winston. Metadata is optional.
//
Logger.prototype.log = function (level, msg) {
Logger.prototype.log = function (level) {
var self = this,
args = Array.prototype.slice.call(arguments, 1),
msg = common.format(args),
callback,
meta;

if (arguments.length === 3) {
if (typeof arguments[2] === 'function') {
if (args.length === 1) {
if (typeof args[0] === 'function') {
meta = {};
callback = arguments[2];
callback = args[0];
}
else if (typeof arguments[2] === 'object') {
meta = arguments[2];
else if (typeof args[0] === 'object') {
meta = args[0];
}
}
else if (arguments.length === 4) {
meta = arguments[2];
callback = arguments[3];
else if (args.length === 2) {
meta = args[0];
callback = args[1];
}

// If we should pad for levels, do so
Expand All @@ -150,7 +152,7 @@ Logger.prototype.log = function (level, msg) {
}
else if (self.emitErrs) {
self.emit('error', err);
};
}
}

if (this.transports.length === 0) {
Expand Down

0 comments on commit a5950cb

Please sign in to comment.