A dueler is only a good as his finest lift.
A dueler is only a good as his finest lift.
A dueler is only a good as his finest lift.
A dueler is only a good as his finest lift.
--[[
* @title Logger
* @author Pedant
* @desc Imaginative title says all. Saves logs of
* everything that uses SAY (basically anything in that
* little chatbox that you echo() into).
* @note Gotta love these docblocky comments. :D
]]--
local filename = os.date():sub(0, 8):gsub('/', '-')
local file = io.open('logs/' .. filename .. '.txt', 'a+', true)
file:write('Logging started:' .. os.date():sub(9) .. '\n')
local function autostart()
local asFile = io.open('profile.tbs', 'a+', true)
if (not asFile:read('*a'):find('logger.lua')) then
asFile:write('loadscript logger.lua\n')
end
asFile:close()
end
add_hook('console', 'logger_console_hook', function(s, i)
file:write(s .. '\n')
end)
add_hook('unload', 'logger_unload_hook', function()
file:write('Logging closed:' .. os.date():sub(9) .. '\n\n')
file:close()
end)
autostart()