Add close() check
This commit is contained in:
parent
93dd730bde
commit
4c7da26f13
|
@ -27,7 +27,7 @@ var Logger = function(filename) {
|
||||||
|
|
||||||
Logger.prototype.log = function () {
|
Logger.prototype.log = function () {
|
||||||
if(this.dead) {
|
if(this.dead) {
|
||||||
Logger.errlog.log("WARNING: Attempted write to dead logger: ", this.filename);
|
errlog.log("WARNING: Attempted write to dead logger: ", this.filename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var msg = "";
|
var msg = "";
|
||||||
|
@ -38,6 +38,10 @@ Logger.prototype.log = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.prototype.close = function () {
|
Logger.prototype.close = function () {
|
||||||
|
if(this.dead) {
|
||||||
|
errlog.log("WARNING: Attempted closure on dead logger: ", this.filename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.writer.end("", null, function () {
|
this.writer.end("", null, function () {
|
||||||
this.dead = true;
|
this.dead = true;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue