Decorate service
This commit is contained in:
parent
b0f2306c50
commit
e351a77f75
|
@ -75,7 +75,7 @@ function getPackageJsonFields(): {
|
|||
const parsedContent = JSON.parse(content)
|
||||
return {
|
||||
VERSION: parsedContent.version,
|
||||
SERVICE_NAME: parsedContent.name.replace(/@budibase\//, ""),
|
||||
SERVICE_NAME: parsedContent.name,
|
||||
}
|
||||
} catch {
|
||||
// throwing an error here is confusing/causes backend-core to be hard to import
|
||||
|
@ -168,6 +168,7 @@ const environment = {
|
|||
// @ts-ignore
|
||||
environment[key] = value
|
||||
},
|
||||
ROLLING_LOG_MAX_SIZE: process.env.ROLLING_LOG_MAX_SIZE || "100M",
|
||||
}
|
||||
|
||||
// clean up any environment variable edge cases
|
||||
|
|
|
@ -24,7 +24,9 @@ if (!env.DISABLE_PINO_LOGGER) {
|
|||
return { level: label.toUpperCase() }
|
||||
},
|
||||
bindings: () => {
|
||||
return {}
|
||||
return {
|
||||
service: env.SERVICE_NAME,
|
||||
}
|
||||
},
|
||||
},
|
||||
timestamp: () => `,"timestamp":"${new Date(Date.now()).toISOString()}"`,
|
||||
|
@ -36,8 +38,7 @@ if (!env.DISABLE_PINO_LOGGER) {
|
|||
destinations.push(pinoPretty({ singleLine: true }))
|
||||
}
|
||||
|
||||
// TODO
|
||||
if (true) {
|
||||
if (env.SELF_HOSTED) {
|
||||
destinations.push(localFileDestination())
|
||||
}
|
||||
|
||||
|
@ -71,9 +72,9 @@ if (!env.DISABLE_PINO_LOGGER) {
|
|||
}
|
||||
|
||||
function localFileDestination() {
|
||||
const fileName = path.join(budibaseTempDir(), "logs", `budibase.logs`)
|
||||
const fileName = path.join(budibaseTempDir(), `budibase.logs`)
|
||||
const outFile = rfs.createStream(fileName, {
|
||||
size: "10M",
|
||||
size: env.ROLLING_LOG_MAX_SIZE,
|
||||
teeToStdout: true,
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue