mirror of
https://github.com/imezx/Warp.git
synced 2025-04-24 15:10:03 +00:00
32 lines
536 B
Lua
32 lines
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
|