Closed
Description
To close all the loggers with a callback completion (similar to the commented one):
Logger.prototype.close = function (cb){
if (this._closed) return cb ();
var me = this;
var remaining = this.streams.length;
if (!remaining) return cb ();
this.streams.forEach (function (s){
s.stream.stream.on ("close", function (){
if (!--remaining && cb) cb ();
});
s.stream.stream.end ();
});
this._closed = true;
};
EDIT: this code only works when the file type is "rotation-file". If it's the normal file then s.stream.end()
and s.stream.on("close")
should be used.
Not tested with childs. Sorry for all the posted issues but this module needs to be revisited.
Metadata
Metadata
Assignees
Labels
No labels