Newer
Older
Kristify / src / Basalt / libraries / basaltLogs.lua
@Sammy Sammy on 4 Sep 2022 566 bytes Removed submodule mark
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