# signature { license=0, seed=277031123, key="d78fd678c0b249684f315957e21d38e2" }





local lfs = require( 'lfs' )

local logFileName = 'logfile.txt'
local function log( ... )
	local a = lfs.attributes( logFileName, 'size' ) or 0
	if 10000 < a then
		local old = 'logfile.old'
		os.remove( old )
		os.rename( logFileName, old )
	end

	local file = io.open( logFileName, 'a+' )
	file:write( os.date( '%Y-%m-%d %H:%M:%S ' ) )
	local args = { ... }
	for i = 1, #args do
		args[ i ] = tostring( args[ i ] )
	end
	file:write ( table.concat( args, ' ' ) )
	file:write ( '\n' )
	file:close()

	print( ... )
end

return log