@govuk-one-login/frontend-passthrough-headers is a set of functions to extract pass-through headers that should be passed through our frontends to our backends.
Add to your project using npm i @govuk-one-login/frontend-passthrough-headers
[!WARNING] This function extracts headers that contain Personal Data. It must not be passed through to API calls to external services.
The frontend-passthrough-headers library allows you to set a custom logger or use the default pino logger.
Setting a Custom Logger
Use the setCustomLogger function to configure a custom logger. The custom logger must implement the following interface:
export type CustomLogger = {
trace: (message: string) => void;
warn: (message: string) => void;
};
Example:
import { setCustomLogger } from "@govuk-one-login/frontend-passthrough-headers";
const customLogger = {
trace: (message: string) => console.log(`TRACE: ${message}`),
warn: (message: string) => console.warn(`WARN: ${message}`),
};
setCustomLogger(customLogger);
Default Logger
If no custom logger is set, a pino logger is used with: • Name: @govuk-one-login/frontend-passthrough-headers • Log Level: process.env.LOG_LEVEL or process.env.LOGS_LEVEL (defaults to warn).
By default, the logger is initialised only once, and calling setCustomLogger again will log a warning.
Please raise any issues on the GitHub repo.