OC-PsychOS/modules/util/logflush.lua

17 lines
312 B
Lua
Raw Normal View History

spawn("logflushd",function()
local lt = os.time()
while true do
if os.time() > 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)