2017-09-04 20:13:31 +10:00
|
|
|
spawn("logflushd",function()
|
2017-09-10 15:23:46 +10:00
|
|
|
local lt = computer.uptime()
|
2017-09-11 13:52:44 +10:00
|
|
|
local logs = ""
|
2017-09-04 20:13:31 +10:00
|
|
|
while true do
|
2017-09-11 13:52:44 +10:00
|
|
|
_, sev, fac, line = event.pull("syslog")
|
|
|
|
logs = "["..tostring(computer.uptime()).."] ["..tostring(sev).."] ["..tostring(fac).."] "..tostring(v)
|
|
|
|
if computer.uptime() > lt+60 then
|
|
|
|
local f = io.open("/tmp/sys.log","ab")
|
2017-09-04 20:13:31 +10:00
|
|
|
if f then
|
2017-09-11 13:52:44 +10:00
|
|
|
f:write(logs)
|
|
|
|
logs = ""
|
|
|
|
f:close()
|
2017-09-04 20:13:31 +10:00
|
|
|
end
|
|
|
|
end
|
|
|
|
coroutine.yield()
|
|
|
|
end
|
|
|
|
end)
|