Skip to content

Commit 2632eb8

Browse files
committed
add option for EOL chars on FileTransport
1 parent bdecce7 commit 2632eb8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

docs/transports.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ The File transport should really be the 'Stream' transport since it will accept
6666
* __maxFiles:__ Limit the number of files created when the size of the logfile is exceeded.
6767
* __stream:__ The WriteableStream to write output to.
6868
* __json:__ If true, messages will be logged as JSON (default true).
69+
* __eol:__ string indicating the end-of-live characters to use (default to `\n`).
6970

7071
*Metadata:* Logged via util.inspect(meta);
7172

lib/winston/transports/file.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ var File = exports.File = function (options) {
7474
this.prettyPrint = options.prettyPrint || false;
7575
this.label = options.label || null;
7676
this.timestamp = options.timestamp != null ? options.timestamp : true;
77+
this.eol = options.eol || '\n';
7778

7879
if (this.json) {
7980
this.stringify = options.stringify;
@@ -130,7 +131,7 @@ File.prototype.log = function (level, msg, meta, callback) {
130131
timestamp: this.timestamp,
131132
stringify: this.stringify,
132133
label: this.label
133-
}) + '\n';
134+
}) + this.eol;
134135

135136
this._size += output.length;
136137

0 commit comments

Comments
 (0)