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
1 changed files with 8 additions and 7 deletions

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()