diff --git a/modules/debug/log.lua b/modules/debug/log.lua index 63d304f..deb1cc2 100644 --- a/modules/debug/log.lua +++ b/modules/debug/log.lua @@ -1,12 +1,20 @@ +_G.DEFAC, _G.DESEV = 6, 0 if component then _G.Log = "" function log(...) - for k,v in ipairs({...}) do - if component.list("ocemu")() then - component.invoke(component.list("ocemu")(),"log",v) - end - Log=Log.."["..tostring(computer.uptime()).."] "..tostring(v).."\n" + local ta = {...} + local sev, fac = _G.DEFAC, _G.DESEV + if ta[#ta] == true then + ta[#ta] = nil + sev, fac = table.remove(ta,#ta),table.remove(ta,#ta) + end + for k,v in ipairs(ta) do + 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" + computer.pushSignal("syslog",sev,fac,v) + end end print=log else log = print diff --git a/modules/setup.lua b/modules/setup.lua index 599be5c..11106f2 100644 --- a/modules/setup.lua +++ b/modules/setup.lua @@ -1,3 +1,4 @@ +_G.DEFAC = 1 if component.list("gpu")() and component.list("screen")() and component.list("keyboard")() and tty and kbd then tty(component.list("gpu")(),component.list("screen")()) log(pcall(function()