Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

winston-daily-rotate-file

Package Overview
Dependencies
Maintainers
2
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

winston-daily-rotate-file - npm Package Compare versions

Comparing version 1.6.0 to 1.7.0

6

index.js

@@ -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;

6

package.json
{
"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 () {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc