made logflush use the newer APIs and shit

This commit is contained in:
Izaya 2017-09-11 13:52:44 +10:00
parent 21a9c66d8d
commit 10615bfecb

View File

@ -1,14 +1,15 @@
spawn("logflushd",function()
local lt = computer.uptime()
local logs = ""
while true do
if computer.uptime() > lt + 60 and Log:len() > 0 then
local f = fs.open("/tmp/sys.log","ab")
_, 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")
if f then
for i = 1, #Log, 1024 do
fs.write(f,Log:sub(i,i+1023))
end
fs.close(f)
Log = ""
f:write(logs)
logs = ""
f:close()
end
end
coroutine.yield()