Add close() check

This commit is contained in:
calzoneman 2013-07-29 18:16:11 -04:00
parent 93dd730bde
commit 4c7da26f13
1 changed files with 5 additions and 1 deletions

View File

@ -27,7 +27,7 @@ var Logger = function(filename) {
Logger.prototype.log = function () {
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;
}
var msg = "";
@ -38,6 +38,10 @@ Logger.prototype.log = 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.dead = true;
});