Socket
Socket
Sign inDemoInstall

winston

Package Overview
Dependencies
29
Maintainers
8
Versions
82
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.9.0 to 3.10.0

9

dist/winston.js

@@ -46,2 +46,7 @@ /**

* Expose core Logging-related prototypes.
* @type {function}
*/
exports.Logger = require('./winston/logger');
/**
* Expose core Logging-related prototypes.
* @type {Object}

@@ -156,4 +161,2 @@ */

warn.forFunctions(exports, 'deprecated', ['addRewriter', 'addFilter', 'clone', 'extend']);
warn.forProperties(exports, 'deprecated', ['emitErrs', 'levelLength']);
// Throw a useful error when users attempt to run `new winston.Logger`.
warn.moved(exports, 'createLogger', 'Logger');
warn.forProperties(exports, 'deprecated', ['emitErrs', 'levelLength']);

@@ -35,13 +35,2 @@ /**

},
moved: function moved(obj, movedTo, prop) {
function movedNotice() {
return function () {
throw new Error([format('winston.%s was moved in winston@3.0.0.', prop), format('Use a winston.%s instead.', movedTo)].join('\n'));
};
}
Object.defineProperty(obj, prop, {
get: movedNotice,
set: movedNotice
});
},
forProperties: function forProperties(obj, type, props) {

@@ -48,0 +37,0 @@ props.forEach(function (prop) {

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /* eslint-disable no-console */

@@ -103,2 +103,3 @@ /* eslint-disable complexity,max-statements */

_this.tailable = options.tailable || false;
_this.lazy = options.lazy || false;

@@ -113,4 +114,5 @@ // Internal state variables representing the number of files this instance

_this._ending = false;
_this._fileExist = false;
if (_this.dirname) _this._createLogDirIfNotExist(_this.dirname);
_this.open();
if (!_this.lazy) _this.open();
return _this;

@@ -177,2 +179,28 @@ }

}
if (this.lazy) {
if (!this._fileExist) {
if (!this._opening) {
this.open();
}
this.once('open', function () {
_this3._fileExist = true;
_this3.log(info, callback);
return;
});
return;
}
if (this._needsNewFile(this._pendingSize)) {
this._dest.once('close', function () {
if (!_this3._opening) {
_this3.open();
}
_this3.once('open', function () {
_this3.log(info, callback);
return;
});
return;
});
return;
}
}

@@ -209,2 +237,8 @@ // Grab the raw string and append the expected EOL.

}
if (this.lazy) {
this._endStream(function () {
_this4.emit('fileclosed');
});
return;
}

@@ -578,3 +612,3 @@ // End the current stream, ensure it flushes and create a new one.

*
* @param {ReadableStream} source ā€“Ā PassThrough to pipe to the file when open.
* @param {ReadableStream} source ā€“PassThrough to pipe to the file when open.
* @returns {WritableStream} Stream that writes to disk for the active file.

@@ -581,0 +615,0 @@ */

@@ -124,6 +124,6 @@ // Type definitions for winston 3.0

log: LogMethod;
add(transport: Transport): Logger;
remove(transport: Transport): Logger;
clear(): Logger;
close(): Logger;
add(transport: Transport): this;
remove(transport: Transport): this;
clear(): this;
close(): this;

@@ -157,7 +157,7 @@ // for cli and npm levels

startTimer(): Profiler;
profile(id: string | number, meta?: LogEntry): Logger;
profile(id: string | number, meta?: Record<string, any>): this;
configure(options: LoggerOptions): void;
child(options: Object): Logger;
child(options: Object): this;

@@ -164,0 +164,0 @@ isLevelEnabled(level: string): boolean;

@@ -45,2 +45,7 @@ /**

* Expose core Logging-related prototypes.
* @type {function}
*/
exports.Logger = require('./winston/logger');
/**
* Expose core Logging-related prototypes.
* @type {Object}

@@ -176,3 +181,2 @@ */

warn.forProperties(exports, 'deprecated', ['emitErrs', 'levelLength']);
// Throw a useful error when users attempt to run `new winston.Logger`.
warn.moved(exports, 'createLogger', 'Logger');

@@ -37,17 +37,2 @@ /**

},
moved(obj, movedTo, prop) {
function movedNotice() {
return () => {
throw new Error([
format('winston.%s was moved in winston@3.0.0.', prop),
format('Use a winston.%s instead.', movedTo)
].join('\n'));
};
}
Object.defineProperty(obj, prop, {
get: movedNotice,
set: movedNotice
});
},
forProperties(obj, type, props) {

@@ -54,0 +39,0 @@ props.forEach(prop => {

@@ -0,0 +0,0 @@ // Type definitions for winston 3.0

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /* eslint-disable no-console */

@@ -82,2 +82,3 @@ /* eslint-disable complexity,max-statements */

this.tailable = options.tailable || false;
this.lazy = options.lazy || false;

@@ -92,5 +93,6 @@ // Internal state variables representing the number of files this instance

this._ending = false;
this._fileExist = false;
if (this.dirname) this._createLogDirIfNotExist(this.dirname);
this.open();
if (!this.lazy) this.open();
}

@@ -112,3 +114,2 @@

/**

@@ -120,3 +121,3 @@ * Core logging method exposed to Winston. Metadata is optional.

*/
log(info, callback = () => {}) {
log(info, callback = () => { }) {
// Remark: (jcrugzz) What is necessary about this callback(null, true) now

@@ -130,2 +131,3 @@ // when thinking about 3.x? Should silent be handled in the base

// Output stream buffer is full and has asked us to wait for the drain event

@@ -146,2 +148,28 @@ if (this._drain) {

}
if (this.lazy) {
if (!this._fileExist) {
if (!this._opening) {
this.open();
}
this.once('open', () => {
this._fileExist = true;
this.log(info, callback);
return;
});
return;
}
if (this._needsNewFile(this._pendingSize)) {
this._dest.once('close', () => {
if (!this._opening) {
this.open();
}
this.once('open', () => {
this.log(info, callback);
return;
});
return;
});
return;
}
}

@@ -178,2 +206,6 @@ // Grab the raw string and append the expected EOL.

}
if (this.lazy) {
this._endStream(() => {this.emit('fileclosed')});
return;
}

@@ -518,3 +550,2 @@ // End the current stream, ensure it flushes and create a new one.

stream.destroy();
return stream;

@@ -537,3 +568,3 @@ }

*/
_endStream(callback = () => {}) {
_endStream(callback = () => { }) {
if (this._dest) {

@@ -554,3 +585,3 @@ this._stream.unpipe(this._dest);

*
* @param {ReadableStream} source ā€“Ā PassThrough to pipe to the file when open.
* @param {ReadableStream} source ā€“PassThrough to pipe to the file when open.
* @returns {WritableStream} Stream that writes to disk for the active file.

@@ -557,0 +588,0 @@ */

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ // Type definitions for winston 3.0

{
"name": "winston",
"description": "A logger for just about everything.",
"version": "3.9.0",
"version": "3.10.0",
"author": "Charlie Robbins <charlie.robbins@gmail.com>",

@@ -44,3 +44,3 @@ "maintainers": [

"@dabh/eslint-config-populist": "^5.0.0",
"@types/node": "^18.0.0",
"@types/node": "^20.3.1",
"abstract-winston-transport": "^0.5.1",

@@ -47,0 +47,0 @@ "assume": "^2.2.0",

@@ -229,2 +229,3 @@ # winston

```
> `.child` is likely to be bugged if you're also extending the `Logger` class, due to some implementation details that make `this` keyword to point to unexpected things. Use with caution.

@@ -768,7 +769,7 @@ ### Streams, `objectMode`, and `info` objects

}),
new transports.Http({
new winston.transports.Http({
level: 'warn',
format: winston.format.json()
}),
new transports.Console({
new winston.transports.Console({
level: 'info',

@@ -775,0 +776,0 @@ format: winston.format.combine(

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with āš”ļø by Socket Inc