1
0
Fork 0
mirror of synced 2024-08-19 03:51:29 +12:00

Merge branch 'develop' of github.com:Budibase/budibase into develop

This commit is contained in:
mike12345567 2023-07-21 17:27:19 +01:00
commit 6cdc844168

View file

@ -12,29 +12,44 @@ import { localFileDestination } from "../system"
let pinoInstance: pino.Logger | undefined let pinoInstance: pino.Logger | undefined
if (!env.DISABLE_PINO_LOGGER) { if (!env.DISABLE_PINO_LOGGER) {
const level = env.LOG_LEVEL
const pinoOptions: LoggerOptions = { const pinoOptions: LoggerOptions = {
level: env.LOG_LEVEL, level,
formatters: { formatters: {
level: label => { level: level => {
return { level: label.toUpperCase() } return { level: level.toUpperCase() }
}, },
bindings: () => { bindings: () => {
return { if (env.SELF_HOSTED) {
service: env.SERVICE_NAME, // "service" is being injected in datadog using the pod names,
// so we should leave it blank to allow the default behaviour if it's not running self-hosted
return {
service: env.SERVICE_NAME,
}
} else {
return {}
} }
}, },
}, },
timestamp: () => `,"timestamp":"${new Date(Date.now()).toISOString()}"`, timestamp: () => `,"timestamp":"${new Date(Date.now()).toISOString()}"`,
} }
const destinations: pino.DestinationStream[] = [] const destinations: pino.StreamEntry[] = []
if (env.isDev()) { destinations.push(
destinations.push(pinoPretty({ singleLine: true })) env.isDev()
} ? {
stream: pinoPretty({ singleLine: true }),
level: level as pino.Level,
}
: { stream: process.stdout, level: level as pino.Level }
)
if (env.SELF_HOSTED) { if (env.SELF_HOSTED) {
destinations.push(localFileDestination()) destinations.push({
stream: localFileDestination(),
level: level as pino.Level,
})
} }
pinoInstance = destinations.length pinoInstance = destinations.length