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.1.1 to 1.1.2

6

index.js

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

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