Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Revert "Use common.format inside every log method"

This reverts commit acc2444.
  • Loading branch information...
commit d546f75b4774962c7a36c1edc6426187bd36fa87 1 parent b8cf35c
@fb55 fb55 authored
View
22 lib/winston/logger.js
@@ -120,25 +120,23 @@ 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) {
+Logger.prototype.log = function (level, msg) {
var self = this,
- args = Array.prototype.slice.call(arguments, 1),
- msg = common.format(args),
callback,
meta;
- if (args.length === 1) {
- if (typeof args[0] === 'function') {
+ if (arguments.length === 3) {
+ if (typeof arguments[2] === 'function') {
meta = {};
- callback = args[0];
+ callback = arguments[2];
}
- else if (typeof args[0] === 'object') {
- meta = args[0];
+ else if (typeof arguments[2] === 'object') {
+ meta = arguments[2];
}
}
- else if (args.length === 2) {
- meta = args[0];
- callback = args[1];
+ else if (arguments.length === 4) {
+ meta = arguments[2];
+ callback = arguments[3];
}
// If we should pad for levels, do so
@@ -152,7 +150,7 @@ Logger.prototype.log = function (level) {
}
else if (self.emitErrs) {
self.emit('error', err);
- }
+ };
}
if (this.transports.length === 0) {
View
12 lib/winston/transports/console.js
@@ -53,18 +53,14 @@ Console.prototype.name = 'console';
// #### @callback {function} Continuation to respond to when complete.
// Core logging method exposed to Winston. Metadata is optional.
//
-Console.prototype.log = function (level) {
- var self = this,
- args = Array.prototype.slice.call(arguments, 1),
- msg = common.format(args),
- meta = args[0],
- callback = args[1],
- output;
-
+Console.prototype.log = function (level, msg, meta, callback) {
if (this.silent) {
return callback(null, true);
}
+ var self = this,
+ output;
+
output = common.log({
colorize: this.colorize,
json: this.json,
View
13 lib/winston/transports/file.js
@@ -97,19 +97,14 @@ File.prototype.name = 'file';
// #### @callback {function} Continuation to respond to when complete.
// Core logging method exposed to Winston. Metadata is optional.
//
-File.prototype.log = function (level) {
- var self = this,
- args = Array.prototype.slice.call(arguments, 1),
- msg = common.format(args),
- meta = args[0],
- callback = args[1],
- output;
-
+File.prototype.log = function (level, msg, meta, callback) {
if (this.silent) {
return callback(null, true);
}
- output = common.log({
+ var self = this;
+
+ var output = common.log({
level: level,
message: msg,
meta: meta,
View
9 lib/winston/transports/http.js
@@ -1,6 +1,5 @@
var util = require('util'),
winston = require('../../winston'),
- common = require('../common'),
request = require('request'),
Stream = require('stream').Stream;
@@ -70,12 +69,8 @@ Http.prototype._request = function (options, callback) {
// #### @callback {function} Continuation to respond to when complete.
// Core logging method exposed to Winston. Metadata is optional.
//
-Http.prototype.log = function (level) {
- var self = this,
- args = Array.prototype.slice.call(arguments, 1),
- msg = common.format(args),
- meta = args[0],
- callback = args[1];
+Http.prototype.log = function (level, msg, meta, callback) {
+ var self = this;
if (typeof meta === 'function') {
callback = meta;
View
11 lib/winston/transports/webhook.js
@@ -62,18 +62,13 @@ Webhook.prototype.name = 'webhook';
// #### @callback {function} Continuation to respond to when complete.
// Core logging method exposed to Winston. Metadata is optional.
//
-Webhook.prototype.log = function (level) {
- var self = this,
- args = Array.prototype.slice.call(arguments, 1),
- msg = common.format(args),
- meta = args[0],
- callback = args[1];
-
+Webhook.prototype.log = function (level, msg, meta, callback) {
if (this.silent) {
return callback(null, true);
}
- var meta = cycle.decycle(meta),
+ var self = this,
+ meta = cycle.decycle(meta),
message = common.clone(meta),
options,
req;
Please sign in to comment.
Something went wrong with that request. Please try again.