Browse files

[api] Use `options.name` when creating a new transport

Winston uses `transport.name` to distinguish transports and don't allow
duplicates to be created. It's convenient to be able to set this
property from `options` object when creating an instance of a transport.
  • Loading branch information...
1 parent 16dc3a9 commit 1456706c7c4d855575e7d194786eed7eed1d9d39 @mmalecki mmalecki committed May 7, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/winston/transports/transport.js
View
3 lib/winston/transports/transport.js
@@ -22,6 +22,7 @@ var Transport = exports.Transport = function (options) {
this.level = options.level || 'info';
this.silent = options.silent || false;
this.raw = options.raw || false;
+ this.name = options.name;
this.handleExceptions = options.handleExceptions || false;
};
@@ -56,4 +57,4 @@ Transport.prototype.logException = function (msg, meta, callback) {
this.once('logged', onLogged);
this.once('error', onError);
this.log('error', msg, meta, function () { });
-};
+};

0 comments on commit 1456706

Please sign in to comment.