fixed tests broken by alwaysIncludePattern
This commit is contained in:
@@ -22,7 +22,7 @@ process.on('exit', function() {
|
||||
function appender(filename, pattern, alwaysIncludePattern, layout) {
|
||||
layout = layout || layouts.basicLayout;
|
||||
|
||||
var logFile = new streams.DateRollingFileStream(filename, pattern, alwaysIncludePattern);
|
||||
var logFile = new streams.DateRollingFileStream(filename, pattern, { alwaysIncludePattern: alwaysIncludePattern });
|
||||
openFiles.push(logFile);
|
||||
|
||||
return function(logEvent) {
|
||||
@@ -35,7 +35,7 @@ function configure(config, options) {
|
||||
var layout;
|
||||
|
||||
if (config.layout) {
|
||||
layout = layouts.layout(config.layout.type, config.layout);
|
||||
layout = layouts.layout(config.layout.type, config.layout);
|
||||
}
|
||||
|
||||
if (!config.alwaysIncludePattern) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user