Files
Basalt/Basalt/libraries/basaltLogs.lua
Robert Jelic 8ab06dbc17 1.6.0 Release
Release version of basalt 1.6.0
2022-08-25 22:22:47 +02:00

20 lines
566 B
Lua

local logDir = ""
local logFileName = "basaltLog.txt"
local defaultLogType = "Debug"
fs.delete(logDir~="" and logDir.."/"..logFileName or logFileName)
local mt = {
__call = function(_,text, typ)
if(text==nil)then return end
local dirStr = logDir~="" and logDir.."/"..logFileName or logFileName
local handle = fs.open(dirStr, fs.exists(dirStr) and "a" or "w")
handle.writeLine("[Basalt]["..(typ and typ or defaultLogType).."]: "..tostring(text))
handle.close()
end,
}
return setmetatable({}, mt)
--Work in progress