Made core.log/error store call location instead of view
This commit is contained in:
parent
59881f81a6
commit
9a32a00c73
|
@ -231,8 +231,9 @@ local function log(icon, icon_color, fmt, ...)
|
||||||
core.status_view:show_message(icon, icon_color, text)
|
core.status_view:show_message(icon, icon_color, text)
|
||||||
end
|
end
|
||||||
|
|
||||||
local view = core.active_view and core.active_view:get_name()
|
local info = debug.getinfo(2, "Sl")
|
||||||
local item = { text = text, time = os.time(), view = view }
|
local at = string.format("%s:%d", info.short_src, info.currentline)
|
||||||
|
local item = { text = text, time = os.time(), at = at }
|
||||||
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
|
||||||
table.remove(core.log_items, 1)
|
table.remove(core.log_items, 1)
|
||||||
|
|
|
@ -51,7 +51,7 @@ function LogView:draw()
|
||||||
x = x + style.padding.x
|
x = x + style.padding.x
|
||||||
local subx = x
|
local subx = x
|
||||||
x = renderer.draw_text(style.font, item.text, x, y, style.text)
|
x = renderer.draw_text(style.font, item.text, x, y, style.text)
|
||||||
x = renderer.draw_text(style.font, " in " .. item.view, x, y, style.dim)
|
x = renderer.draw_text(style.font, " at " .. item.at, x, y, style.dim)
|
||||||
y = y + th
|
y = y + th
|
||||||
if item.info then
|
if item.info then
|
||||||
for line in item.info:gmatch("[^\n]+") do
|
for line in item.info:gmatch("[^\n]+") do
|
||||||
|
|
Loading…
Reference in a new issue