Last change
on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
783 bytes
|
Line | |
---|
1 | const RollingFileWriteStream = require('./RollingFileWriteStream');
|
---|
2 |
|
---|
3 | // just to adapt the previous version
|
---|
4 | class DateRollingFileStream extends RollingFileWriteStream {
|
---|
5 | constructor(filename, pattern, options) {
|
---|
6 | if (pattern && typeof(pattern) === 'object') {
|
---|
7 | options = pattern;
|
---|
8 | pattern = null;
|
---|
9 | }
|
---|
10 | if (!options) {
|
---|
11 | options = {};
|
---|
12 | }
|
---|
13 | if (!pattern) {
|
---|
14 | pattern = 'yyyy-MM-dd';
|
---|
15 | }
|
---|
16 | if (options.daysToKeep) {
|
---|
17 | options.numToKeep = options.daysToKeep;
|
---|
18 | }
|
---|
19 | if (pattern.startsWith('.')) {
|
---|
20 | pattern = pattern.substring(1);
|
---|
21 | }
|
---|
22 | options.pattern = pattern;
|
---|
23 | super(filename, options);
|
---|
24 | this.mode = this.options.mode;
|
---|
25 | }
|
---|
26 |
|
---|
27 | get theStream() {
|
---|
28 | return this.currentFileStream;
|
---|
29 | }
|
---|
30 |
|
---|
31 | }
|
---|
32 |
|
---|
33 | module.exports = DateRollingFileStream;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.