@dotcom-reliability-kit/middleware-log-errors
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -8,2 +8,5 @@ export = createErrorLoggingMiddleware; | ||
includeHeaders?: string[] | undefined; | ||
logger?: (import("@dotcom-reliability-kit/log-error").Logger & { | ||
[x: string]: any; | ||
}) | undefined; | ||
}; | ||
@@ -10,0 +13,0 @@ declare namespace exports { |
@@ -7,2 +7,4 @@ const { logHandledError } = require('@dotcom-reliability-kit/log-error'); | ||
* An array of request headers to include in the log. | ||
* @property {import('@dotcom-reliability-kit/log-error').Logger & Object<string, any>} [logger] | ||
* The logger to use to output errors. Defaults to n-logger. | ||
*/ | ||
@@ -41,2 +43,3 @@ | ||
includeHeaders, | ||
logger: options.logger, | ||
request | ||
@@ -43,0 +46,0 @@ }); |
{ | ||
"name": "@dotcom-reliability-kit/middleware-log-errors", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Express middleware to consistently log errors", | ||
@@ -19,6 +19,6 @@ "repository": { | ||
"dependencies": { | ||
"@dotcom-reliability-kit/log-error": "^1.4.0" | ||
"@dotcom-reliability-kit/log-error": "^1.5.0" | ||
}, | ||
"devDependencies": { | ||
"@financial-times/n-express": "^26.3.3", | ||
"@financial-times/n-express": "^26.3.5", | ||
"@types/express": "^4.17.14", | ||
@@ -25,0 +25,0 @@ "node-fetch": "^2.6.7" |
## @dotcom-reliability-kit/middleware-log-errors | ||
# @dotcom-reliability-kit/middleware-log-errors | ||
Express middleware to consistently log errors. This module is part of [FT.com Reliability Kit](https://github.com/Financial-Times/dotcom-reliability-kit#readme). | ||
* [Usage](#usage) | ||
* [`createErrorLogger`](#createerrorlogger) | ||
* [configuration options](#configuration-options) | ||
* [`includeHeaders`](#optionsincludeheaders) | ||
* [Contributing](#contributing) | ||
* [License](#license) | ||
* [Usage](#usage) | ||
* [`createErrorLogger`](#createerrorlogger) | ||
* [Configuration options](#configuration-options) | ||
* [`options.includeHeaders`](#optionsincludeheaders) | ||
* [`options.logger`](#optionslogger) | ||
* [Contributing](#contributing) | ||
* [License](#license) | ||
@@ -132,3 +133,13 @@ | ||
#### `options.logger` | ||
A logger object which implements two methods, `error` and `warn`, which have the following permissive signature: | ||
```ts | ||
type LogMethod = (...logData: any) => any; | ||
``` | ||
This is passed directly onto the relevant log-error method, [see the documentation for that package for more details](../log-error/README.md#optionslogger). | ||
## Contributing | ||
@@ -135,0 +146,0 @@ |
Sorry, the diff of this file is not supported yet
8500
67
153