Fixes for version v0.10 streams, breaks log4js for older versions of node
This commit is contained in:
@@ -23,9 +23,7 @@ function DateRollingFileStream(filename, pattern, options, now) {
|
||||
debug("this.now is " + this.now + ", now is " + now);
|
||||
|
||||
DateRollingFileStream.super_.call(this, filename, options);
|
||||
this.rollBeforeWrite = true;
|
||||
}
|
||||
|
||||
util.inherits(DateRollingFileStream, BaseRollingFileStream);
|
||||
|
||||
DateRollingFileStream.prototype.shouldRoll = function() {
|
||||
@@ -45,14 +43,12 @@ DateRollingFileStream.prototype.roll = function(filename, callback) {
|
||||
newFilename = filename + this.previousTime;
|
||||
|
||||
debug("Starting roll");
|
||||
debug("Queueing up data until we've finished rolling");
|
||||
debug("Flushing underlying stream");
|
||||
this.flush();
|
||||
|
||||
async.series([
|
||||
deleteAnyExistingFile,
|
||||
renameTheCurrentFile,
|
||||
openANewFile
|
||||
this.closeTheStream.bind(this),
|
||||
deleteAnyExistingFile,
|
||||
renameTheCurrentFile,
|
||||
this.openTheStream.bind(this)
|
||||
], callback);
|
||||
|
||||
function deleteAnyExistingFile(cb) {
|
||||
@@ -69,21 +65,4 @@ DateRollingFileStream.prototype.roll = function(filename, callback) {
|
||||
fs.rename(filename, newFilename, cb);
|
||||
}
|
||||
|
||||
function openANewFile(cb) {
|
||||
debug("Opening a new file");
|
||||
fs.open(
|
||||
filename,
|
||||
that.options.flags,
|
||||
that.options.mode,
|
||||
function (err, fd) {
|
||||
debug("opened new file");
|
||||
var oldLogFileFD = that.fd;
|
||||
that.fd = fd;
|
||||
that.writable = true;
|
||||
fs.close(oldLogFileFD, cb);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user