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