From c92f6a7b7f26d478c7d7d9ef4c4e93ee8fb79b5a Mon Sep 17 00:00:00 2001 From: Guldoman Date: Tue, 31 May 2022 02:26:18 +0200 Subject: [PATCH] Always show backtrace for `error` log entries --- data/core/init.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/data/core/init.lua b/data/core/init.lua index 74471006..884c77bf 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -1056,7 +1056,7 @@ function core.get_views_referencing_doc(doc) end -local function log(level, show, fmt, ...) +function log(level, show, backtrace, fmt, ...) local text = string.format(fmt, ...) if show then local s = style.log[level] @@ -1069,7 +1069,8 @@ local function log(level, show, fmt, ...) level = level, text = text, time = os.time(), - at = at + at = at, + info = backtrace and debug.traceback(nil, 2):gsub("\t", "") } table.insert(core.log_items, item) if #core.log_items > config.max_log_items then @@ -1080,17 +1081,17 @@ end function core.log(...) - return log("INFO", true, ...) + return log("INFO", true, false, ...) end function core.log_quiet(...) - return log("INFO", false, ...) + return log("INFO", false, false, ...) end function core.error(...) - return log("ERROR", true, ...) + return log("ERROR", true, true, ...) end