fixed tests broken by alwaysIncludePattern

This commit is contained in:
Gareth Jones
2013-05-05 13:44:01 +10:00
parent 097ae3d7f1
commit 936ad4da8e
4 changed files with 69 additions and 69 deletions

View File

@@ -13,25 +13,30 @@ if (process.env.NODE_DEBUG && /\blog4js\b/.test(process.env.NODE_DEBUG)) {
debug = function() { };
}
function DateRollingFileStream(filename, pattern, alwaysIncludePattern, options, now) {
debug("Now is " + now);
if (pattern && typeof(pattern) === 'object') {
now = options;
options = pattern;
pattern = null;
}
this.pattern = pattern || '.yyyy-MM-dd';
this.now = now || Date.now;
this.lastTimeWeWroteSomething = format.asString(this.pattern, new Date(this.now()));
function DateRollingFileStream(filename, pattern, options, now) {
debug("Now is " + now);
if (pattern && typeof(pattern) === 'object') {
now = options;
options = pattern;
pattern = null;
}
this.pattern = pattern || '.yyyy-MM-dd';
this.now = now || Date.now;
this.lastTimeWeWroteSomething = format.asString(this.pattern, new Date(this.now()));
this.baseFilename = filename;
this.alwaysIncludePattern = alwaysIncludePattern;
if (this.alwaysIncludePattern) {
this.baseFilename = filename;
filename = filename + this.lastTimeWeWroteSomething;
if (options) {
if (options.alwaysIncludePattern) {
filename = filename + this.lastTimeWeWroteSomething;
}
debug("this.now is " + this.now + ", now is " + now);
delete options.alwaysIncludePattern;
if (options === {}) {
options = null;
}
}
debug("this.now is " + this.now + ", now is " + now);
DateRollingFileStream.super_.call(this, filename, options);
DateRollingFileStream.super_.call(this, filename, options);
}
util.inherits(DateRollingFileStream, BaseRollingFileStream);