1
0
Fork 0
mirror of synced 2024-07-04 22:11:23 +12:00

Setup error logging

This commit is contained in:
Adria Navarro 2024-02-12 14:01:00 +01:00
parent b27ca57e1a
commit 93eb9fc9c8
2 changed files with 9 additions and 2 deletions

View file

@ -97,6 +97,7 @@ const environment = {
APP_MIGRATION_TIMEOUT: parseIntSafe(process.env.APP_MIGRATION_TIMEOUT),
JS_RUNNER_MEMORY_LIMIT:
parseIntSafe(process.env.JS_RUNNER_MEMORY_LIMIT) || 64,
LOG_JS_ERRORS: process.env.LOG_JS_ERRORS,
}
// threading can cause memory issues with node-ts in development

View file

@ -1,7 +1,7 @@
import vm from "vm"
import env from "../environment"
import { setJSRunner } from "@budibase/string-templates"
import { context, timers } from "@budibase/backend-core"
import { setJSRunner, setOnErrorLog } from "@budibase/string-templates"
import { context, logging, timers } from "@budibase/backend-core"
import tracer from "dd-trace"
type TrackerFn = <T>(f: () => T) => T
@ -58,4 +58,10 @@ export function init() {
)
})
})
if (env.LOG_JS_ERRORS) {
setOnErrorLog((error: Error) => {
logging.logWarn(JSON.stringify(error))
})
}
}