OC-PsychOS/modules/util/logflush.lua

17 lines
328 B
Lua

spawn("logflushd",function()
local lt = computer.uptime()
while true do
if computer.uptime() > lt + 60 and Log:len() > 0 then
local f = fs.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 = ""
end
end
coroutine.yield()
end
end)