Warp/src/Index/Server/ServerProcess/Logger.luau
EternityDev 9aaa382278 v1.0.9
2024-04-02 13:10:21 +07:00

32 lines
No EOL
536 B
Lua

--!strict
local Logger = {}
local Logs: {
[string]: {
[string]: string
}
} = {}
local logging: {
[string]: boolean
} = {}
local now = tick()
function Logger.write(Identifier: string, text: string, log: boolean?)
if not Logs[Identifier] then
Logs[Identifier] = {}
end
if log ~= nil then
logging[Identifier] = log
end
now = tick()
Logs[Identifier][tostring(now)] = text
if logging[Identifier] then
print(`[{now}] ->`, text)
end
end
function Logger.read(Identifier: string)
return Logs[Identifier]
end
return Logger