winston-daily-rotate-file
Advanced tools
Comparing version 1.2.0 to 1.3.0
23
index.js
@@ -80,2 +80,3 @@ 'use strict'; | ||
this.prepend = options.prepend || false; | ||
this.localTime = options.localTime || false; | ||
@@ -126,9 +127,17 @@ if (this.json) { | ||
var now = new Date(); | ||
this._year = now.getUTCFullYear(); | ||
this._month = now.getUTCMonth(); | ||
this._date = now.getUTCDate(); | ||
this._hour = now.getUTCHours(); | ||
this._minute = now.getUTCMinutes(); | ||
this._weekday = weekday[now.getUTCDay()]; | ||
if (this.localTime) { | ||
this._year = now.getFullYear(); | ||
this._month = now.getMonth(); | ||
this._date = now.getDate(); | ||
this._hour = now.getHours(); | ||
this._minute = now.getMinutes(); | ||
this._weekday = weekday[now.getDay()]; | ||
} else { | ||
this._year = now.getUTCFullYear(); | ||
this._month = now.getUTCMonth(); | ||
this._date = now.getUTCDate(); | ||
this._hour = now.getUTCHours(); | ||
this._minute = now.getUTCMinutes(); | ||
this._weekday = weekday[now.getUTCDay()]; | ||
} | ||
var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhM])\1?/g; | ||
@@ -135,0 +144,0 @@ var pad = function (val, len) { |
{ | ||
"name": "winston-daily-rotate-file", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "A transport for winston which logs to a rotating file each day.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -57,2 +57,13 @@ /* eslint-disable max-nested-callbacks,no-unused-expressions */ | ||
it('should have a proper filename when prepend option is false (localtime)', function () { | ||
var now = moment().format('YYYY-MM-DD'); | ||
var transport = new DailyRotateFile({ | ||
filename: path.join(fixturesDir, 'prepend-false.log'), | ||
localTime: true, | ||
prepend: false | ||
}); | ||
expect(transport._getFilename()).to.equal('prepend-false.log.' + now); | ||
}); | ||
it('should have a proper filename when prepend options is true', function () { | ||
@@ -59,0 +70,0 @@ var now = moment().utc().format('YYYY-MM-DD'); |
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
44312
1123