Always show backtrace for `error` log entries

This commit is contained in:
Guldoman 2022-05-31 02:26:18 +02:00
parent 4f0d45d6ab
commit c92f6a7b7f
No known key found for this signature in database
GPG Key ID: EA928C8BDA1A8825
1 changed files with 6 additions and 5 deletions

View File

@ -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