@dotcom-reliability-kit/log-error
Advanced tools
Comparing version 4.1.2 to 4.1.3
@@ -7,40 +7,10 @@ const appInfo = require('@dotcom-reliability-kit/app-info'); | ||
/** | ||
* @typedef {(...logData: any) => any} LogMethod | ||
* @typedef {import('@dotcom-reliability-kit/log-error').ErrorLoggingOptions} ErrorLoggingOptions | ||
*/ | ||
/** | ||
* @typedef {object} Logger | ||
* @property {LogMethod} error | ||
* A function to log an error. | ||
* @property {LogMethod} [fatal] | ||
* A function to log a fatal error. | ||
* @property {LogMethod} warn | ||
* A function to log a warning. | ||
*/ | ||
/** | ||
* @typedef {object} ErrorLoggingOptions | ||
* @property {(string | Error & Record<string, any>)} error | ||
* The error to log. | ||
* @property {string[]} [includeHeaders] | ||
* An array of request headers to include in the log. | ||
* @property {Logger & {[key: string]: any}} [logger] | ||
* The logger to use to output errors. Defaults to Reliability Kit logger. | ||
* @property {(string | import('@dotcom-reliability-kit/serialize-request').Request)} [request] | ||
* An request object to include in the log. | ||
*/ | ||
/** | ||
* @typedef {object} InternalErrorLoggingOptions | ||
* @property {string} event | ||
* The event to log. | ||
* @property {("error" | "fatal" | "warn")} level | ||
* The log level to use. One of "error", "fatal", or "warn". | ||
*/ | ||
/** | ||
* Log an error object with optional request information. | ||
* | ||
* @private | ||
* @param {ErrorLoggingOptions & InternalErrorLoggingOptions} options | ||
* @param {ErrorLoggingOptions & {event: string, level: 'error' | 'fatal' | 'warn'}} options | ||
* The data to log. | ||
@@ -114,6 +84,3 @@ * @returns {void} | ||
* | ||
* @public | ||
* @param {ErrorLoggingOptions} options | ||
* The data to log. | ||
* @returns {void} | ||
* @type {typeof import('@dotcom-reliability-kit/log-error').logHandledError} | ||
*/ | ||
@@ -134,6 +101,3 @@ function logHandledError({ error, includeHeaders, logger, request }) { | ||
* | ||
* @public | ||
* @param {ErrorLoggingOptions} options | ||
* The data to log. | ||
* @returns {void} | ||
* @type {typeof import('@dotcom-reliability-kit/log-error').logHandledError} | ||
*/ | ||
@@ -154,6 +118,3 @@ function logRecoverableError({ error, includeHeaders, logger, request }) { | ||
* | ||
* @public | ||
* @param {ErrorLoggingOptions} options | ||
* The data to log. | ||
* @returns {void} | ||
* @type {typeof import('@dotcom-reliability-kit/log-error').logHandledError} | ||
*/ | ||
@@ -160,0 +121,0 @@ function logUnhandledError({ error, includeHeaders, logger, request }) { |
{ | ||
"name": "@dotcom-reliability-kit/log-error", | ||
"version": "4.1.2", | ||
"version": "4.1.3", | ||
"description": "A method to consistently log error object with optional request information", | ||
@@ -17,3 +17,4 @@ "repository": { | ||
}, | ||
"main": "lib", | ||
"main": "lib/index.js", | ||
"types": "types/index.d.ts", | ||
"dependencies": { | ||
@@ -20,0 +21,0 @@ "@dotcom-reliability-kit/app-info": "^3.2.0", |
13409
4
141