From 67d858441ae0ad1101cae557b8792ede69c62443 Mon Sep 17 00:00:00 2001 From: Panagiotis Papadopoulos Date: Sat, 11 Jan 2025 01:45:53 +0100 Subject: [PATCH] refactor(backend_log): include filename in log --- src/routes/api/backend_log.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/routes/api/backend_log.ts b/src/routes/api/backend_log.ts index 318f894c6..acb6d3271 100644 --- a/src/routes/api/backend_log.ts +++ b/src/routes/api/backend_log.ts @@ -9,11 +9,12 @@ import log from "../../services/log.js"; const { LOG_DIR } = dataDir; async function getBackendLog() { + const fileName = `trilium-${dateUtils.localNowDate()}.log` try { - const file = join(LOG_DIR, `trilium-${dateUtils.localNowDate()}.log`); + const file = join(LOG_DIR, fileName); return await readFile(file, "utf8"); } catch (e) { - log.error((e instanceof Error) ? e : "Reading the Backend Log failed with an unknown error."); + log.error((e instanceof Error) ? e : `Reading the backend log '${fileName}' failed with an unknown error.`); // most probably the log file does not exist yet - https://github.com/zadam/trilium/issues/1977 return "";