@dotcom-reliability-kit/logger
Advanced tools
Comparing version
@@ -53,5 +53,5 @@ export = Logger; | ||
type LogTransform = (logData: { | ||
[x: string]: any; | ||
[key: string]: any; | ||
}) => { | ||
[x: string]: any; | ||
[key: string]: any; | ||
}; | ||
@@ -58,0 +58,0 @@ type LogLevelInfo = { |
@@ -21,3 +21,3 @@ const pino = require('pino').default; | ||
* beneath this will be ignored. | ||
* @property {Array<LogTransform>} [transforms = []] | ||
* @property {LogTransform[]} [transforms = []] | ||
* Transforms to apply to logs before sending. | ||
@@ -38,5 +38,5 @@ * @property {boolean} [withPrettifier = true] | ||
* @callback LogTransform | ||
* @param {Object<string, any>} logData | ||
* @param {{[key: string]: any}} logData | ||
* The log data to transform. | ||
* @returns {Object<string, any>} | ||
* @returns {{[key: string]: any}} | ||
* Returns the transformed log data. | ||
@@ -76,3 +76,3 @@ */ | ||
* | ||
* @type {Object<string, LogLevelInfo>} | ||
* @type {{[key: string]: LogLevelInfo}} | ||
*/ | ||
@@ -92,2 +92,9 @@ const logLevelToTransportMethodMap = { | ||
/** | ||
* A list of supported log levels. | ||
* | ||
* @type {string[]} | ||
*/ | ||
const logLevels = Object.keys(logLevelToTransportMethodMap); | ||
/** | ||
* Whether log prettification is available. This is based | ||
@@ -136,3 +143,3 @@ * on two things: the pino-pretty module being installed | ||
/** | ||
* @type {Array<LogTransform>} | ||
* @type {LogTransform[]} | ||
*/ | ||
@@ -147,3 +154,3 @@ #transforms = []; | ||
/** | ||
* @type {Array<string>} | ||
* @type {string[]} | ||
*/ | ||
@@ -230,2 +237,10 @@ #deprecatedMethodTracker = []; | ||
} | ||
// Bind the log level methods so that they can be used without | ||
// the `this` context, e.g. as event handlers | ||
for (const logLevel of logLevels) { | ||
if (typeof this[logLevel] === 'function') { | ||
this[logLevel] = this[logLevel].bind(this); | ||
} | ||
} | ||
} | ||
@@ -538,3 +553,3 @@ | ||
* The log data. | ||
* @returns {Object<string, any>} | ||
* @returns {{[key: string]: any}} | ||
* Returns a single zipped object containing all log data. | ||
@@ -541,0 +556,0 @@ */ |
/** | ||
* @typedef {object} LegacyMaskTransformOptions | ||
* @property {Array<string>} [denyList] | ||
* @property {string[]} [denyList] | ||
* Additional field names to apply masking to. | ||
* @property {Array<string>} [allowList] | ||
* @property {string[]} [allowList] | ||
* Field names to allow from the default deny list. | ||
@@ -27,3 +27,3 @@ * @property {string} [maskString] | ||
* @private | ||
* @type {Array<string>} | ||
* @type {string[]} | ||
*/ | ||
@@ -50,3 +50,3 @@ const DEFAULT_MASKED_FIELDS = [ | ||
* @private | ||
* @type {Array<string>} | ||
* @type {string[]} | ||
*/ | ||
@@ -53,0 +53,0 @@ const ERROR_OBJECT_PROPERTIES = [ |
{ | ||
"name": "@dotcom-reliability-kit/logger", | ||
"version": "2.2.5", | ||
"version": "2.2.6", | ||
"description": "A simple and fast logger based on Pino, with FT preferences baked in", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
48721
0.65%825
1.6%