--=== V 2.3 ===-- -- _filename: the file name of the log file -- _msg: the message to be logged -- _logtime: true for logging time stamp -- _subfolder: String with name of subfolder if data is to be stored in a subfolder of rom\logs\ --=== _logtype ===-- --"new" overwrites existing log file with new info --"add" add to new line at end of file (this is default if not specified) function logInfo(_filename,_msg,_logtime,_subfolder,_logtype) local file, err, filename if type(_msg) ~= "string" or type(_filename) ~= "string" then cprintf(cli.red,"Incorrect usage of logInfo function\n") return end if type(_subfolder) == "string" then if not (isDirectory(getExecutionPath() .. "/logs/" .. _subfolder)) then os.execute("mkdir \"" .. string.gsub(getExecutionPath(), "/+", "\\") .. "\\logs\\".._subfolder.."\"") end _filename = _subfolder.."/".._filename end filename = getExecutionPath() .. "/logs/".._filename..".txt" if type(_logtype) == "string" and string.find(_logtype,"new") then file, err = io.open(filename, "w") else file, err = io.open(filename, "a+") end if( not file ) then cprintf(cli.red,err.."\n") return end if _logtime == true then file:write(os.date().." ") end file:write(_msg.."\n") file:close() end