Skip to content

Instantly share code, notes, and snippets.

@rockerBOO
Created December 8, 2020 01:00
Show Gist options
  • Save rockerBOO/8f4c41b71a95d434ec5eae0e4386747d to your computer and use it in GitHub Desktop.
Save rockerBOO/8f4c41b71a95d434ec5eae0e4386747d to your computer and use it in GitHub Desktop.
-- Very simple file logger for lua
-- local log = log_to_file('mylogfile.log')
-- log('my string')
local log_to_file = function(logfile)
return function(log)
local file = io.open(logfile, "a")
if not file then return end
file:write(log .. "\n")
file:close()
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment