Skip to content

Commit

Permalink
add option for EOL chars on FileTransport
Browse files Browse the repository at this point in the history
  • Loading branch information
jfromaniello committed Dec 9, 2014
1 parent bdecce7 commit 2632eb8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/transports.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ The File transport should really be the 'Stream' transport since it will accept
* __maxFiles:__ Limit the number of files created when the size of the logfile is exceeded.
* __stream:__ The WriteableStream to write output to.
* __json:__ If true, messages will be logged as JSON (default true).
* __eol:__ string indicating the end-of-live characters to use (default to `\n`).

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

Expand Down
3 changes: 2 additions & 1 deletion lib/winston/transports/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ var File = exports.File = function (options) {
this.prettyPrint = options.prettyPrint || false;
this.label = options.label || null;
this.timestamp = options.timestamp != null ? options.timestamp : true;
this.eol = options.eol || '\n';

if (this.json) {
this.stringify = options.stringify;
Expand Down Expand Up @@ -130,7 +131,7 @@ File.prototype.log = function (level, msg, meta, callback) {
timestamp: this.timestamp,
stringify: this.stringify,
label: this.label
}) + '\n';
}) + this.eol;

this._size += output.length;

Expand Down

0 comments on commit 2632eb8

Please sign in to comment.