You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

33 lines
783 B

const RollingFileWriteStream = require('./RollingFileWriteStream');
// just to adapt the previous version
class DateRollingFileStream extends RollingFileWriteStream {
constructor(filename, pattern, options) {
if (pattern && typeof(pattern) === 'object') {
options = pattern;
pattern = null;
}
if (!options) {
options = {};
}
if (!pattern) {
pattern = 'yyyy-MM-dd';
}
if (options.daysToKeep) {
options.numToKeep = options.daysToKeep;
}
if (pattern.startsWith('.')) {
pattern = pattern.substring(1);
}
options.pattern = pattern;
super(filename, options);
this.mode = this.options.mode;
}
get theStream() {
return this.currentFileStream;
}
}
module.exports = DateRollingFileStream;