From e745ae05e9dd7f0bf3b5cd6cdbe8c444f23d2121 Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Fri, 8 Sep 2017 14:50:34 +1000 Subject: [PATCH] more logging improvements --- modules/debug/log.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/debug/log.lua b/modules/debug/log.lua index deb1cc2..78c20cd 100644 --- a/modules/debug/log.lua +++ b/modules/debug/log.lua @@ -1,6 +1,7 @@ _G.DEFAC, _G.DESEV = 6, 0 if component then _G.Log = "" + _G.logt = {} function log(...) local ta = {...} local sev, fac = _G.DEFAC, _G.DESEV @@ -12,8 +13,15 @@ if component then if component.list("ocemu")() then component.invoke(component.list("ocemu")(),"log",v) end - Log=Log.."["..tostring(computer.uptime()).."] ["..tostring(sev).."] ["..tostring(fac).."] "..tostring(v).."\n" + logt[#logt+1] = "["..tostring(computer.uptime()).."] ["..tostring(sev).."] ["..tostring(fac).."] "..tostring(v) computer.pushSignal("syslog",sev,fac,v) + if #logt > 16 then + table.remove(logt,1) + end + end + Log = "" + for k,v in ipairs(logt) do + Log=Log .. v .. "\n" end end print=log