forked from 26F-Studio/Zenitha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.lua
37 lines (30 loc) · 727 Bytes
/
log.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
-- use LOG(message) to print messages
local ins=table.insert
local startDate=os.date("%Y/%m/%d %A")
local logs={}
local function log(message)
ins(logs,os.date("[%H:%M:%S] ")..message)
end
local LOG=setmetatable({},{
__call=function(_,message)
print(message)
log(message)
end,
__metatable=true,
})
---Get raw logs data
---@return string[] #READ ONLY, DO NOT MODIFY
function LOG.getLogs()
return logs
end
---Get all logged strings as a big string
---@return string
function LOG.getString()
return
STRING.repD("$1 $2 logs $3\n",
ZENITHA.getAppName(),
ZENITHA.getVersionText(),
startDate
)..table.concat(logs,"\n")
end
return LOG