winston-daily-rotate-file
Advanced tools
Comparing version 1.6.0 to 1.7.0
@@ -11,2 +11,3 @@ 'use strict'; | ||
var winston = require('winston'); | ||
var mkdirp = require('mkdirp'); | ||
var zlib = require('zlib'); | ||
@@ -82,2 +83,3 @@ | ||
this.prepend = options.prepend || false; | ||
this.createTree = options.createTree || false; | ||
this.localTime = options.localTime || false; | ||
@@ -550,2 +552,6 @@ this.zippedArchive = options.zippedArchive || false; | ||
if (self.createTree) { | ||
mkdirp.sync(path.dirname(fullname)); | ||
} | ||
self._size = size; | ||
@@ -552,0 +558,0 @@ self.filename = target; |
{ | ||
"name": "winston-daily-rotate-file", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "A transport for winston which logs to a rotating file each day.", | ||
@@ -34,3 +34,2 @@ "main": "index.js", | ||
"eslint-config-xo-space": "0.13.0", | ||
"mkdirp": "0.5.1", | ||
"mocha": "2.4.5", | ||
@@ -47,3 +46,6 @@ "moment": "2.13.0", | ||
} | ||
}, | ||
"dependencies": { | ||
"mkdirp": "0.5.1" | ||
} | ||
} |
@@ -36,2 +36,3 @@ # winston-daily-rotate-file | ||
* __maxDays:__ A number representing the maximum number of days a log file will be saved. Any log file older than this specified number of days will be removed. If not value or a 0, no log files will be removed. | ||
* __createTree:__ When combined with a `datePattern` that includes path delimiters, the transport will create the entire folder tree to the log file. Example: `datePattern: '/yyyy/MM/dd.log', createTree: true` will create the entire path to the log file prior to writing an entry. | ||
@@ -38,0 +39,0 @@ Valid meta characters in the datePattern are: |
@@ -46,2 +46,32 @@ /* eslint-disable max-nested-callbacks,no-unused-expressions */ | ||
describe('an instance of the transport', function () { | ||
describe('with / characters in the datePattern', function () { | ||
it('should create the full path', function (done) { | ||
var now = moment(); | ||
var transport = new DailyRotateFile({ | ||
filename: path.join(fixturesDir, 'application'), | ||
datePattern: '/yyyy/MM/dd.log', | ||
createTree: true | ||
}); | ||
transport.log('info', 'test message', {}, function (err) { | ||
if (err) { | ||
done(err); | ||
} | ||
fs.readFile(path.join(fixturesDir, 'application', now.format('YYYY'), now.format('MM'), now.format('DD') + '.log'), 'utf8', function (err, contents) { | ||
if (err) { | ||
done(err); | ||
} | ||
var lines = contents.split('\n').filter(function (n) { | ||
return n !== ''; | ||
}); | ||
expect(lines.length).to.equal(1); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
describe('with default datePatterns', function () { | ||
@@ -48,0 +78,0 @@ it('should have a proper filename when prepend option is false', function () { |
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
61379
7
1484
66
2
+ Addedmkdirp@0.5.1
+ Addedminimist@0.0.8(transitive)
+ Addedmkdirp@0.5.1(transitive)