winston-daily-rotate-file
Advanced tools
Comparing version 1.7.0 to 1.7.1
@@ -294,3 +294,3 @@ 'use strict'; | ||
// TODO when maxfilesize rotate occurs | ||
var createdFiles = self._currentFiles; // _currentFiles array is already sorted chronologically | ||
var createdFiles = self._currentFiles.slice(0); // Clone already sorted _currentFiles array | ||
var results = []; | ||
@@ -300,2 +300,6 @@ var row = 0; | ||
if (createdFiles.length === 0 && callback) { | ||
callback(null, results); | ||
} | ||
// Edit so that all created files are read: | ||
@@ -302,0 +306,0 @@ (function readNextFile(nextFile) { |
{ | ||
"name": "winston-daily-rotate-file", | ||
"version": "1.7.0", | ||
"version": "1.7.1", | ||
"description": "A transport for winston which logs to a rotating file each day.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -328,4 +328,5 @@ /* eslint-disable max-nested-callbacks,no-unused-expressions */ | ||
afterEach(function () { | ||
afterEach(function (done) { | ||
tk.reset(); | ||
done(); | ||
}); | ||
@@ -404,4 +405,5 @@ | ||
afterEach(function () { | ||
afterEach(function (done) { | ||
tk.reset(); | ||
done(); | ||
}); | ||
@@ -757,3 +759,9 @@ | ||
} | ||
transport.log('error', 'test message', {}, function (err) { | ||
var filesCreated = fs.readdirSync(rotationLogPath); | ||
expect(filesCreated.length).to.eql(1); | ||
expect(filesCreated).to.include(pattern.oldfile); | ||
self.time = new Date(pattern.mid); | ||
tk.travel(self.time); | ||
transport.log('error', '2nd test message', {}, function (err) { | ||
if (err) { | ||
@@ -763,43 +771,22 @@ done(err); | ||
var filesCreated = fs.readdirSync(rotationLogPath); | ||
expect(filesCreated.length).to.eql(1); | ||
expect(filesCreated).to.include(pattern.oldfile); | ||
self.time = new Date(pattern.mid); | ||
filesCreated = fs.readdirSync(rotationLogPath); | ||
expect(filesCreated.length).to.eql(2); | ||
expect(filesCreated).to.include(pattern.oldfile + '.gz'); | ||
expect(filesCreated).to.include(pattern.midfile); | ||
self.time = new Date(pattern.end); | ||
tk.travel(self.time); | ||
transport.log('error', '2nd test message', {}, function (err) { | ||
transport.log('error', '3rd test message', {}, function (err) { | ||
if (err) { | ||
done(err); | ||
} | ||
transport.log('error', 'test message', {}, function (err) { | ||
if (err) { | ||
done(err); | ||
} | ||
filesCreated = fs.readdirSync(rotationLogPath); | ||
expect(filesCreated.length).to.eql(2); | ||
expect(filesCreated).to.include(pattern.oldfile + '.gz'); | ||
expect(filesCreated).to.include(pattern.midfile); | ||
self.time = new Date(pattern.end); | ||
tk.travel(self.time); | ||
transport.log('error', '3rd test message', {}, function (err) { | ||
if (err) { | ||
done(err); | ||
} | ||
transport.log('error', 'test message', {}, function (err) { | ||
if (err) { | ||
done(err); | ||
} | ||
filesCreated = fs.readdirSync(rotationLogPath); | ||
expect(filesCreated.length).to.eql(3); | ||
expect(filesCreated).to.not.include(pattern.newfile + '.1'); | ||
expect(filesCreated).to.include(pattern.newfile); | ||
expect(filesCreated).to.include(pattern.midfile + '.gz'); | ||
expect(filesCreated).to.include(pattern.oldfile + '.gz'); | ||
transport.close(); | ||
filesCreated = fs.readdirSync(rotationLogPath); | ||
expect(filesCreated.length).to.eql(3); | ||
expect(filesCreated).to.not.include(pattern.newfile + '.1'); | ||
expect(filesCreated).to.include(pattern.newfile); | ||
expect(filesCreated).to.include(pattern.midfile + '.gz'); | ||
expect(filesCreated).to.include(pattern.oldfile + '.gz'); | ||
transport.close(); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
done(); | ||
}); | ||
@@ -806,0 +793,0 @@ }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1507
60749
3