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

helper method to call process exit #23

Merged
merged 1 commit into from Aug 16, 2017
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

helper method to call process exit

  • Loading branch information
Shweta Jain
Shweta Jain committed Aug 8, 2017
commit 4a2770c034dfa416aa0be48a883a1925d734bd59
@@ -17,6 +17,8 @@ var events = require('events'),
//
var code = /\u001b\[(\d+(;\d+)*)?m/g;

var timerFunctionForProcessExit = null;

//
// ### function Loggly (options)
// #### @options {Object} Options for this instance.
@@ -62,6 +64,18 @@ var Loggly = exports.Loggly = function (options) {
this.stripColors = options.stripColors || false;
};

//
// Helper function to call process.exit() after waiting
// 10 seconds.
//
var flushLogsAndExit = exports.flushLogsAndExit = function () {
if (timerFunctionForProcessExit === null) {
timerFunctionForProcessExit = setInterval(function () {
process.exit();
},10000);
}
}

//
// Inherit from `winston.Transport`.
//
@@ -72,6 +86,7 @@ util.inherits(Loggly, winston.Transport);
// is available and thus backwards compatible.
//
winston.transports.Loggly = Loggly;
winston.transports.flushLogsAndExit = flushLogsAndExit;

//
// Expose the name of this Transport on the prototype
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.