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 2.0.0-rc.1 to 2.0.0-rc.2

32

daily-rotate-file.js

@@ -11,2 +11,3 @@ 'use strict';

var compat = require('winston-compat');
var PassThrough = require('stream').PassThrough;
var Transport = semver.major(winston.version) === 2 ? compat.Transport : require('winston-transport');

@@ -30,6 +31,3 @@

var DailyRotateFile = function (options) {
if (!options) {
options = {};
}
options = options || {};
Transport.call(this, options);

@@ -62,3 +60,4 @@

throwIf('stream', 'filename', 'maxsize');
this.logStream = options.stream;
this.logStream = new PassThrough();
this.logStream.pipe(options.stream);
} else {

@@ -118,4 +117,6 @@ this.filename = options.filename ? path.basename(options.filename) : 'winston.log';

var noop = function () {};
if (semver.major(winston.version) === 2) {
DailyRotateFile.prototype.log = function (level, msg, meta, callback) {
callback = callback || noop;
var options = Object.assign({}, this.options, {

@@ -127,3 +128,5 @@ level: level,

this._internalLog(options, callback);
var output = compat.log(options) + options.eol;
this.logStream.write(output);
callback(null, true);
};

@@ -133,16 +136,11 @@ } else {

DailyRotateFile.prototype.log = function (info, callback) {
var options = Object.assign({}, this.options, info);
this._internalLog(options, callback);
var MESSAGE = Symbol.for('message');
callback = callback || noop;
this.logStream.write(info[MESSAGE] + this.options.eol);
this.emit('logged', info);
callback(null, true);
};
}
DailyRotateFile.prototype._internalLog = function (options, callback) {
var opts = Object.assign({}, this.options, options);
var output = compat.log(opts) + this.options.eol;
this.logStream.write(output);
if (callback) {
callback(null, true);
}
};
DailyRotateFile.prototype.close = function () {

@@ -149,0 +147,0 @@ if (this.logStream) {

{
"name": "winston-daily-rotate-file",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"description": "A transport for winston which logs to a rotating file each day.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -19,6 +19,16 @@ /* eslint-disable max-nested-callbacks,no-unused-expressions,handle-callback-err */

} else {
transport.log({
var logger = winston.createLogger({
transports: [transport]
});
transport.on('logged', function () {
if (cb) {
cb(null, true);
}
});
logger.info({
level: level,
message: message
}, cb);
});
}

@@ -25,0 +35,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