blob: 9bf52f741b03e3f3fbd8a9eb8773d936da7342ef [file] [log] [blame]
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;