22 lines
565 B
Lua
22 lines
565 B
Lua
_G.DEFAC, _G.DESEV = 6, 0
|
|
if component then
|
|
_G.Log = ""
|
|
function log(...)
|
|
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
|
|
end
|