winston-daily-rotate-file
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -72,3 +72,3 @@ 'use strict'; | ||
this.timestamp = options.timestamp ? options.timestamp : true; | ||
this.datePattern = options.datePattern ? options.datePattern : '.yyyy-MM-dd'; | ||
this.datePattern = options.datePattern ? options.datePattern : 'yyyy-MM-dd'; | ||
this.depth = options.depth || null; | ||
@@ -605,6 +605,6 @@ this.eol = options.eol || os.EOL; | ||
if (this.prepend) { | ||
return formattedDate + this._basename; | ||
return [formattedDate, this._basename].join('.'); | ||
} | ||
return this._basename + formattedDate; | ||
return [this._basename, formattedDate].join('.'); | ||
}; | ||
@@ -611,0 +611,0 @@ |
{ | ||
"name": "winston-daily-rotate-file", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "A transport for winston which logs to a rotating file each day.", | ||
@@ -36,2 +36,3 @@ "main": "index.js", | ||
"mocha": "2.4.5", | ||
"moment": "2.13.0", | ||
"rimraf": "2.5.2" | ||
@@ -38,0 +39,0 @@ }, |
@@ -9,2 +9,3 @@ /* eslint-disable max-nested-callbacks,no-unused-expressions */ | ||
var mkdirp = require('mkdirp'); | ||
var moment = require('moment'); | ||
var MemoryStream = require('./memory-stream'); | ||
@@ -21,3 +22,3 @@ | ||
filename: path.join(fixturesDir, 'testfilename.log'), | ||
datePattern: '.yyyy-MM-dd' | ||
prepend: false | ||
}), | ||
@@ -27,3 +28,2 @@ 'stream': new DailyRotateFile({stream: new MemoryStream()}), | ||
filename: path.join(fixturesDir, 'testfilename.log'), | ||
datePattern: 'yyyy-MM-dd_', | ||
prepend: true | ||
@@ -35,2 +35,24 @@ }) | ||
describe('an instance of the transport', function () { | ||
describe('with default datePatterns', function () { | ||
it('should have a proper filename when prepend option is false', function () { | ||
var now = moment().format('YYYY-MM-DD'); | ||
var transport = new DailyRotateFile({ | ||
filename: path.join(fixturesDir, 'prepend-false.log'), | ||
prepend: false | ||
}); | ||
expect(transport._getFilename()).to.equal('prepend-false.log.' + now); | ||
}); | ||
it('should have a proper filename when prepend options is true', function () { | ||
var now = moment().format('YYYY-MM-DD'); | ||
var transport = new DailyRotateFile({ | ||
filename: path.join(fixturesDir, 'prepend-true.log'), | ||
prepend: true | ||
}); | ||
expect(transport._getFilename()).to.equal(now + '.prepend-true.log'); | ||
}); | ||
}); | ||
Object.keys(transports).forEach(function (t) { | ||
@@ -89,4 +111,3 @@ describe('when passed a valid ' + t, function () { | ||
transport = new DailyRotateFile({ | ||
filename: path.join(fixturesDir, 'invalid', 'testfilename.log'), | ||
datePattern: '.yyyy-MM-dd' | ||
filename: path.join(fixturesDir, 'invalid', 'testfilename.log') | ||
}); | ||
@@ -93,0 +114,0 @@ }); |
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
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
26872
706
7