File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ var events = require('events'),
1717//
1818var code = / \u001b \[ ( \d + ( ; \d + ) * ) ? m / g;
1919
20+ var timerFunctionForProcessExit = null ;
21+
2022//
2123// ### function Loggly (options)
2224// #### @options {Object} Options for this instance.
@@ -62,6 +64,18 @@ var Loggly = exports.Loggly = function (options) {
6264 this . stripColors = options . stripColors || false ;
6365} ;
6466
67+ //
68+ // Helper function to call process.exit() after waiting
69+ // 10 seconds.
70+ //
71+ var flushLogsAndExit = exports . flushLogsAndExit = function ( ) {
72+ if ( timerFunctionForProcessExit === null ) {
73+ timerFunctionForProcessExit = setInterval ( function ( ) {
74+ process . exit ( ) ;
75+ } , 10000 ) ;
76+ }
77+ }
78+
6579//
6680// Inherit from `winston.Transport`.
6781//
@@ -72,6 +86,7 @@ util.inherits(Loggly, winston.Transport);
7286// is available and thus backwards compatible.
7387//
7488winston . transports . Loggly = Loggly ;
89+ winston . transports . flushLogsAndExit = flushLogsAndExit ;
7590
7691//
7792// Expose the name of this Transport on the prototype
You can’t perform that action at this time.
0 commit comments