Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADD Flag to switch the log flushing on and off #166

Merged
merged 1 commit into from
Sep 10, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/configBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@ exports.consumer.logger.inspectDepth = 1;
*/
exports.consumer.logger.exitOnLogError = false;

/**
* Flush Each Message
* true = the logger will flush the buffer to file each time a new message arrives
* false = the logger will lazily write messages to disk
*/
exports.consumer.logger.flushEachMessage = true;

/*
Console.
Expand Down Expand Up @@ -280,6 +286,13 @@ exports.listener.logger.inspectDepth = 1;
exports.listener.logger.exitOnLogError = false;


/**
* Flush Each Message
* true = the logger will flush the buffer to file each time a new message arrives
* false = the logger will lazily write messages to disk
*/
exports.listener.logger.flushEachMessage = true;


/*
Console.
Expand Down
2 changes: 1 addition & 1 deletion lib/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function newLogger() {
var message = createLogMessage.call(this, level, message, logObj).replace(/\n/g, '');

var tmpLogger = winstonLogger.log(level, message);
if (tmpLogger.transports.file._stream)
if (config.flushEachMessage && tmpLogger.transports.file._stream)
tmpLogger.transports.file.flush();
return tmpLogger;
};
Expand Down