2024-04-02 06:10:21 +00:00
|
|
|
--!strict
|
2024-05-11 02:29:53 +00:00
|
|
|
--!native
|
|
|
|
--!optimize 2
|
2024-04-02 06:10:21 +00:00
|
|
|
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
|