Always show backtrace for `error` log entries
This commit is contained in:
parent
4f0d45d6ab
commit
c92f6a7b7f
|
@ -1056,7 +1056,7 @@ function core.get_views_referencing_doc(doc)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function log(level, show, fmt, ...)
|
function log(level, show, backtrace, fmt, ...)
|
||||||
local text = string.format(fmt, ...)
|
local text = string.format(fmt, ...)
|
||||||
if show then
|
if show then
|
||||||
local s = style.log[level]
|
local s = style.log[level]
|
||||||
|
@ -1069,7 +1069,8 @@ local function log(level, show, fmt, ...)
|
||||||
level = level,
|
level = level,
|
||||||
text = text,
|
text = text,
|
||||||
time = os.time(),
|
time = os.time(),
|
||||||
at = at
|
at = at,
|
||||||
|
info = backtrace and debug.traceback(nil, 2):gsub("\t", "")
|
||||||
}
|
}
|
||||||
table.insert(core.log_items, item)
|
table.insert(core.log_items, item)
|
||||||
if #core.log_items > config.max_log_items then
|
if #core.log_items > config.max_log_items then
|
||||||
|
@ -1080,17 +1081,17 @@ end
|
||||||
|
|
||||||
|
|
||||||
function core.log(...)
|
function core.log(...)
|
||||||
return log("INFO", true, ...)
|
return log("INFO", true, false, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function core.log_quiet(...)
|
function core.log_quiet(...)
|
||||||
return log("INFO", false, ...)
|
return log("INFO", false, false, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function core.error(...)
|
function core.error(...)
|
||||||
return log("ERROR", true, ...)
|
return log("ERROR", true, true, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue