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 |
🔴 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.
🟠 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
});
🟠 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.
🔴 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.