Fix pino request id generation (#9324)

Remove the duplicated pino config in favour of the common config. Move request id generation into common configuration
This commit is contained in:
Rory Powell 2023-01-12 10:25:21 +00:00 committed by GitHub
parent 88564b0a7b
commit f85ecd4810
2 changed files with 1 additions and 14 deletions

View File

@ -40,6 +40,7 @@ export function pinoSettings(): Options {
prettyPrint: { prettyPrint: {
levelFirst: true, levelFirst: true,
}, },
genReqId: correlator.getId,
level: env.LOG_LEVEL || "error", level: env.LOG_LEVEL || "error",
autoLogging: { autoLogging: {
ignore: (req: IncomingMessage) => !!req.url?.includes("/health"), ignore: (req: IncomingMessage) => !!req.url?.includes("/health"),

View File

@ -1,14 +0,0 @@
const env = require("./environment")
import { Options } from "pino-http"
const correlator = require("correlation-id")
export const pinoSettings = (): Options => ({
prettyPrint: {
levelFirst: true,
},
genReqId: correlator.getId,
level: env.LOG_LEVEL || "error",
autoLogging: {
ignore: (req: any) => req.url.includes("/health"),
},
})