We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There are two different issues I encountered with the file compression:
I wrote two tests to demonstrate the above mentioned problems:
describe('when zippedArchive is true', function () { var pattern = { pattern: '.m', start: 1861947160000, // GMT: Mon, 01 Jan 2029 07:32:50 GMT mid: 1861947240000, // GMT: Mon, 01 Jan 2029 07:34:00 GMT end: 1861947760000, // GMT: Mon, 01 Jan 2029 07:42:40 GMT oldfile: 'test-rotation.log.32', midfile: 'test-rotation.log.34', newfile: 'test-rotation.log.42' }; var transport; var rotationLogPath = path.join(fixturesDir, 'rotations'); beforeEach(function (done) { this.time = new Date(pattern.start); tk.travel(this.time); rimraf.sync(rotationLogPath); mkdirp.sync(rotationLogPath); transport = new DailyRotateFile({ filename: path.join(rotationLogPath, 'test-rotation.log'), datePattern: pattern.pattern, zippedArchive: true }); done(); }); afterEach(function () { tk.reset(); }); it('should compress logfile even if there is only one log message', function (done) { var self = this; transport.log('error', 'test message', {}, function (err) { if (err) { done(err); } var filesCreated = fs.readdirSync(rotationLogPath); expect(filesCreated.length).to.eql(1); expect(filesCreated).to.include(pattern.oldfile); self.time = new Date(pattern.end); tk.travel(self.time); transport.log('error', '2nd test message', {}, function (err) { if (err) { done(err); } filesCreated = fs.readdirSync(rotationLogPath); expect(filesCreated.length).to.eql(2); expect(filesCreated).to.include(pattern.newfile); expect(filesCreated).to.include(pattern.oldfile + '.gz'); transport.close(); done(); }); }); }); it('should compress logfile without adding count to file extension if there are no files with the same name', function (done) { var self = this; transport.log('error', 'test message', {}, function (err) { if (err) { done(err); } transport.log('error', 'test message', {}, function (err) { if (err) { 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); tk.travel(self.time); transport.log('error', '2nd 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(); done(); }); }); }); }); }); }); }); });`
The text was updated successfully, but these errors were encountered:
#71 updating logic to determine archive creation
b626d08
Thanks for your unit tests, @Konni1337. #74 and b626d08 have been merged which should close this out.
Published 1.4.5 to npm.
Sorry, something went wrong.
No branches or pull requests
There are two different issues I encountered with the file compression:
I wrote two tests to demonstrate the above mentioned problems:
The text was updated successfully, but these errors were encountered: