Permalink
Browse files

Use common.format inside Logger#log

  • Loading branch information...
1 parent d546f75 commit a5950cb4bc00e3dcd5b5d72f508105ba11256b70 @fb55 fb55 committed Jul 27, 2012
Showing with 12 additions and 10 deletions.
  1. +12 −10 lib/winston/logger.js
View
@@ -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
@@ -150,7 +152,7 @@ Logger.prototype.log = function (level, msg) {
}
else if (self.emitErrs) {
self.emit('error', err);
- };
+ }
}
if (this.transports.length === 0) {

0 comments on commit a5950cb

Please sign in to comment.