winston
Advanced tools
Comparing version 3.6.0 to 3.7.1
@@ -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 @@ /** |
@@ -41,3 +41,4 @@ /** | ||
LEVEL = _require2.LEVEL, | ||
SPLAT = _require2.SPLAT; | ||
SPLAT = _require2.SPLAT, | ||
MESSAGE = _require2.MESSAGE; | ||
@@ -58,2 +59,4 @@ var isStream = require('is-stream'); | ||
var config = require('./config'); | ||
var jsonStringify = require('safe-stable-stringify'); | ||
/** | ||
@@ -100,21 +103,8 @@ * Captures the number of format (i.e. %s strings) in a given string. | ||
key: "child", | ||
value: function child(defaultRequestMetadata) { | ||
value: function child(childMetadata) { | ||
var logger = this; | ||
var clonedParentMetadata = JSON.parse(jsonStringify(this.defaultMeta)); | ||
return Object.create(logger, { | ||
write: { | ||
value: function value(info) { | ||
var infoClone = Object.assign({}, defaultRequestMetadata, info); // Object.assign doesn't copy inherited Error | ||
// properties so we have to do that explicitly | ||
// | ||
// Remark (indexzero): we should remove this | ||
// since the errors format will handle this case. | ||
// | ||
if (info instanceof Error) { | ||
infoClone.stack = info.stack; | ||
infoClone.message = info.message; | ||
} | ||
logger.write(infoClone); | ||
} | ||
defaultMeta: { | ||
value: Object.assign({}, clonedParentMetadata, childMetadata) | ||
} | ||
@@ -355,2 +345,6 @@ }); | ||
info[LEVEL] = info.level; | ||
} | ||
if (!info[MESSAGE]) { | ||
info[MESSAGE] = info.message; | ||
} // Remark: really not sure what to do here, but this has been reported as | ||
@@ -739,3 +733,5 @@ // very confusing by pre winston@2.0.0 users as quite confusing when using | ||
if (this.defaultMeta) { | ||
Object.assign(msg, this.defaultMeta); | ||
// The msg must be cloned as it is being mutated, but any metadata provided with the msg takes precedence over default | ||
var msgClone = JSON.parse(jsonStringify(msg)); | ||
Object.assign(msg, this.defaultMeta, msgClone); | ||
} | ||
@@ -742,0 +738,0 @@ } |
@@ -33,2 +33,4 @@ /** | ||
// TODO there is no restriction on what the Profiler considers a Logger. As such there is no guarantees it adheres | ||
// to the proper interface. This needs to hardened. | ||
if (!logger) { | ||
@@ -44,3 +46,4 @@ throw new Error('Logger is required for profiling.'); | ||
* with the duration since creation. | ||
* @returns {mixed} - TODO: add return description. | ||
* @returns {boolean} - `false` if the logger stream wishes for the calling code to wait for the 'drain' event to be | ||
* emitted before continuing to write additional data; otherwise `true` | ||
* @private | ||
@@ -66,2 +69,3 @@ */ | ||
info.durationMs = Date.now() - this.start; | ||
if (this.logger._addDefaultMeta) this.logger._addDefaultMeta(info); | ||
return this.logger.write(info); | ||
@@ -68,0 +72,0 @@ } |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /* eslint-disable no-console */ |
@@ -0,0 +0,0 @@ /* eslint-disable complexity,max-statements */ |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ // Type definitions for winston 3.0 |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -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 @@ /** |
@@ -12,3 +12,3 @@ /** | ||
const asyncForEach = require('async/forEach'); | ||
const { LEVEL, SPLAT } = require('triple-beam'); | ||
const { LEVEL, SPLAT, MESSAGE } = require('triple-beam'); | ||
const isStream = require('is-stream'); | ||
@@ -21,2 +21,3 @@ const ExceptionHandler = require('./exception-handler'); | ||
const config = require('./config'); | ||
const jsonStringify = require('safe-stable-stringify'); | ||
@@ -47,26 +48,8 @@ /** | ||
child(defaultRequestMetadata) { | ||
child(childMetadata) { | ||
const logger = this; | ||
const clonedParentMetadata = JSON.parse(jsonStringify(this.defaultMeta)); | ||
return Object.create(logger, { | ||
write: { | ||
value: function (info) { | ||
const infoClone = Object.assign( | ||
{}, | ||
defaultRequestMetadata, | ||
info | ||
); | ||
// Object.assign doesn't copy inherited Error | ||
// properties so we have to do that explicitly | ||
// | ||
// Remark (indexzero): we should remove this | ||
// since the errors format will handle this case. | ||
// | ||
if (info instanceof Error) { | ||
infoClone.stack = info.stack; | ||
infoClone.message = info.message; | ||
} | ||
logger.write(infoClone); | ||
} | ||
defaultMeta: { | ||
value: Object.assign({}, clonedParentMetadata, childMetadata) | ||
} | ||
@@ -294,2 +277,6 @@ }); | ||
if (!info[MESSAGE]) { | ||
info[MESSAGE] = info.message; | ||
} | ||
// Remark: really not sure what to do here, but this has been reported as | ||
@@ -654,3 +641,5 @@ // very confusing by pre winston@2.0.0 users as quite confusing when using | ||
if (this.defaultMeta) { | ||
Object.assign(msg, this.defaultMeta); | ||
// The msg must be cloned as it is being mutated, but any metadata provided with the msg takes precedence over default | ||
const msgClone = JSON.parse(jsonStringify(msg)); | ||
Object.assign(msg, this.defaultMeta, msgClone); | ||
} | ||
@@ -657,0 +646,0 @@ } |
@@ -24,2 +24,4 @@ /** | ||
constructor(logger) { | ||
// TODO there is no restriction on what the Profiler considers a Logger. As such there is no guarantees it adheres | ||
// to the proper interface. This needs to hardened. | ||
if (!logger) { | ||
@@ -36,3 +38,4 @@ throw new Error('Logger is required for profiling.'); | ||
* with the duration since creation. | ||
* @returns {mixed} - TODO: add return description. | ||
* @returns {boolean} - `false` if the logger stream wishes for the calling code to wait for the 'drain' event to be | ||
* emitted before continuing to write additional data; otherwise `true` | ||
* @private | ||
@@ -50,5 +53,5 @@ */ | ||
info.durationMs = (Date.now()) - this.start; | ||
if (this.logger._addDefaultMeta) this.logger._addDefaultMeta(info); | ||
return this.logger.write(info); | ||
} | ||
}; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /* eslint-disable no-console */ |
@@ -0,0 +0,0 @@ /* eslint-disable complexity,max-statements */ |
@@ -0,0 +0,0 @@ /** |
@@ -62,2 +62,5 @@ // Type definitions for winston 3.0 | ||
headers?: object; | ||
batch?: boolean; | ||
batchInterval?: number; | ||
batchCount?: number; | ||
} | ||
@@ -64,0 +67,0 @@ |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
{ | ||
"name": "winston", | ||
"description": "A logger for just about everything.", | ||
"version": "3.6.0", | ||
"version": "3.7.1", | ||
"author": "Charlie Robbins <charlie.robbins@gmail.com>", | ||
@@ -63,2 +63,3 @@ "maintainers": [ | ||
"lint": "eslint lib/*.js lib/winston/*.js lib/winston/**/*.js --resolve-plugins-relative-to ./node_modules/@dabh/eslint-config-populist", | ||
"lint:fix": "npm run lint -- --fix", | ||
"test": "mocha", | ||
@@ -65,0 +66,0 @@ "test:coverage": "nyc npm run test:unit", |
@@ -0,0 +0,0 @@ # winston |
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
265437
6098
1