Store logs to file

This commit is contained in:
Adria Navarro 2023-07-04 11:54:01 +01:00
parent 19fab7fa97
commit d33663f5ac
1 changed files with 10 additions and 0 deletions

View File

@ -5,6 +5,9 @@ import * as correlation from "../correlation"
import { IdentityType } from "@budibase/types" import { IdentityType } from "@budibase/types"
import { LOG_CONTEXT } from "../index" import { LOG_CONTEXT } from "../index"
import path from "path"
import { budibaseTempDir } from "../../objectStore"
// LOGGER // LOGGER
let pinoInstance: pino.Logger | undefined let pinoInstance: pino.Logger | undefined
@ -29,6 +32,13 @@ if (!env.DISABLE_PINO_LOGGER) {
singleLine: true, singleLine: true,
}, },
} }
} else {
pinoOptions.transport = {
target: "pino/file",
options: {
destination: path.join(budibaseTempDir(), "pino.logs"),
},
}
} }
pinoInstance = pino(pinoOptions) pinoInstance = pino(pinoOptions)