diff --git a/standalone/package.json b/standalone/package.json index 4645383..648e1fd 100644 --- a/standalone/package.json +++ b/standalone/package.json @@ -1,6 +1,6 @@ { "name": "cap-standalone", - "version": "2.1.3", + "version": "2.1.4", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "dev": "bun run --watch src/index.js", diff --git a/standalone/src/index.js b/standalone/src/index.js index 86ec173..8c3976a 100644 --- a/standalone/src/index.js +++ b/standalone/src/index.js @@ -70,20 +70,23 @@ new Elysia({ } const errorId = Bun.randomUUIDv7().split("-").pop(); - console.error(`[${error.code || "ERR"} ${errorId}]`, JSON.stringify({ - timestamp: new Date().toISOString(), - error, - env: { - bun: process.versions.bun, - platform: process.platform, - mem: process.memoryUsage() - } - })); + + if (process.env.DISABLE_ERROR_LOGGING !== "true") { + console.error(`[${error.code || "ERR"} ${errorId}]`, JSON.stringify({ + timestamp: new Date().toISOString(), + error, + env: { + bun: process.versions.bun, + platform: process.platform, + mem: process.memoryUsage() + } + })); + } return { success: false, error: error.code || "Internal server error", - detail: { + detail: process.env.SHOW_ERRORS === "true" ? error : { troubleshooting: "http://capjs.js.org/guide/standalone/options.html#error-messages", id: errorId }