Skip to content

Commit 211483e

Browse files
dboshardyDABH
authored andcommitted
Addresses issue 1446 and assigns transport name if given, or else retains the default 'console' name (#1447)
* 'name transport with assigned name or else set it to default console' * 'change naming to coincide with prescribed style' * 'change http transport to accept parameterized options.name using default it none provided' * 'chnage file transport to accept parameterized options.name using default if none provided'
1 parent bdb9f2b commit 211483e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/winston/transports/console.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = class Console extends TransportStream {
2727
super(options);
2828

2929
// Expose the name of this Transport on the prototype
30-
this.name = 'console';
30+
this.name = options.name || 'console';
3131
this.stderrLevels = this._stringArrayToSet(options.stderrLevels);
3232
this.consoleWarnLevels = this._stringArrayToSet(options.consoleWarnLevels);
3333
this.eol = options.eol || os.EOL;

lib/winston/transports/file.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = class File extends TransportStream {
3333
super(options);
3434

3535
// Expose the name of this Transport on the prototype.
36-
this.name = 'file';
36+
this.name = options.name || 'file';
3737

3838
// Helper function which throws an `Error` in the event that any of the
3939
// rest of the arguments is present in `options`.

lib/winston/transports/http.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = class Http extends TransportStream {
2626
constructor(options = {}) {
2727
super(options);
2828

29-
this.name = 'http';
29+
this.name = options.name || 'http';
3030
this.ssl = !!options.ssl;
3131
this.host = options.host || 'localhost';
3232
this.port = options.port;

0 commit comments

Comments
 (0)