improved logging significantly
This commit is contained in:
parent
c83fd7a482
commit
fa15579f9f
@ -1,12 +1,20 @@
|
|||||||
|
_G.DEFAC, _G.DESEV = 6, 0
|
||||||
if component then
|
if component then
|
||||||
_G.Log = ""
|
_G.Log = ""
|
||||||
function log(...)
|
function log(...)
|
||||||
for k,v in ipairs({...}) do
|
local ta = {...}
|
||||||
if component.list("ocemu")() then
|
local sev, fac = _G.DEFAC, _G.DESEV
|
||||||
component.invoke(component.list("ocemu")(),"log",v)
|
if ta[#ta] == true then
|
||||||
end
|
ta[#ta] = nil
|
||||||
Log=Log.."["..tostring(computer.uptime()).."] "..tostring(v).."\n"
|
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
|
end
|
||||||
|
Log=Log.."["..tostring(computer.uptime()).."] ["..tostring(sev).."] ["..tostring(fac).."] "..tostring(v).."\n"
|
||||||
|
computer.pushSignal("syslog",sev,fac,v)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
print=log
|
print=log
|
||||||
else log = print
|
else log = print
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
_G.DEFAC = 1
|
||||||
if component.list("gpu")() and component.list("screen")() and component.list("keyboard")() and tty and kbd then
|
if component.list("gpu")() and component.list("screen")() and component.list("keyboard")() and tty and kbd then
|
||||||
tty(component.list("gpu")(),component.list("screen")())
|
tty(component.list("gpu")(),component.list("screen")())
|
||||||
log(pcall(function()
|
log(pcall(function()
|
||||||
|
Loading…
Reference in New Issue
Block a user