Skip to content

Latest commit

 

History

History
56 lines (34 loc) · 3.04 KB

File metadata and controls

56 lines (34 loc) · 3.04 KB

Migration guide for @dotcom-reliability-kit/log-error

This document outlines how to migrate to the latest version of the Reliability Kit log-error package. Throughout this guide we use the following emoji and labels to indicate the level of change required:

Emoji Label Meaning
🔴 Breaking A breaking change which will likely require code or config changes to resolve
🟠 Possibly Breaking A breaking change that is unlikely to require code changes but things outside of the code (e.g. logs) may have changed

Migrating from v1 to v2

Node.js 14 is no longer supported

🔴 Breaking: this version drops support for Node.js v14. If your app is already using Node.js v16 or above then you can migrate with no code changes.

Migrating from v2 to v3

Switch to Reliability Kit logger

🟠 Possibly Breaking: this version switches to use Reliability Kit's logger by default. This means that logs will not be sent directly to Splunk but will be sent to stdout. This may mean you lose some logs if you haven't configured your app to forward these logs somewhere more permanent.

You may not need to change anything for this upgrade, for example, if your app uses Heroku log drains or a Lambda log forwarder. The logger migration guide has more information.

If you can't switch to Reliability Kit logger yet, then you can still use n-logger (the previous default logger) by manually passing it as an option when logging errors:

const { logHandledError } = require('@dotcom-reliability-kit/log-error');
const nLogger = require('@financial-times/n-logger').default;

logHandledError({
    error: new Error('Something went wrong'),
    logger: nLogger
});

Unhandled errors now have a level of fatal

🟠 Possibly Breaking: errors logged with logUnhandledError will now have a level property of fatal rather than error. This shouldn't require code changes but you may need to update your saved Splunk searches or dashboards.

Migrating from v3 to v4

Node.js 16 is no longer supported

🔴 Breaking: this version drops support for Node.js v16. If your app is already using Node.js v18 or above then you can migrate with no code changes.