🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@dotcom-reliability-kit/log-error

Package Overview
Dependencies
Maintainers
4
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dotcom-reliability-kit/log-error - npm Package Compare versions

Comparing version

to
1.4.0

4

package.json
{
"name": "@dotcom-reliability-kit/log-error",
"version": "1.3.11",
"version": "1.4.0",
"description": "A method to consistently log error object with optional request information",

@@ -21,3 +21,3 @@ "repository": {

"@dotcom-reliability-kit/serialize-error": "^1.1.4",
"@dotcom-reliability-kit/serialize-request": "^1.0.4",
"@dotcom-reliability-kit/serialize-request": "^1.1.0",
"@financial-times/n-logger": "^10.3.1"

@@ -24,0 +24,0 @@ },

@@ -158,5 +158,18 @@

An array of request headers to include in the serialized request object (if one is provided with `options.request`). This must be an `Array` of `String`s, with each string being a header name. It's important that you do not include headers which include personally-identifiable-information, API keys, or other privileged information. This defaults to `['accept', 'content-type']`. This option gets passed directly into [`dotcom-reliability-kit/serialize-request`](https://github.com/Financial-Times/dotcom-reliability-kit/tree/main/packages/serialize-request#readme) which has further documentation.
An array of request headers to include in the serialized request object (if one is provided with `options.request`). This must be an `Array` of `String`s, with each string being a header name. It's important that you do not include headers which include personally-identifiable-information, API keys, or other privileged information. This option gets passed directly into [`dotcom-reliability-kit/serialize-request`](https://github.com/Financial-Times/dotcom-reliability-kit/tree/main/packages/serialize-request#readme) which has further documentation.
This option defaults to:
```js
[
'accept',
'accept-encoding',
'accept-language',
'content-type',
'referer',
'user-agent'
]
```
Example of usage:
```js
logRecoverableError({

@@ -173,2 +186,16 @@ // ...other required options

The default set of headers is also available to use, so that you don't need to repeat them if you want to add new included headers. You'll need to import `@dotcom-reliability-kit/serialize-request`, then these headers are available:
```js
const { DEFAULT_INCLUDED_HEADERS } = require('@dotcom-reliability-kit/serialize-request');
logRecoverableError({
// ...other required options
includeHeaders: [
...DEFAULT_INCLUDED_HEADERS,
'my-custom-header'
]
});
```
> **Note**

@@ -175,0 +202,0 @@ > There's no need to include the `x-request-id` header in this array, as this is automatically included as `request.id` in the logs.