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