-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogger.lua
57 lines (50 loc) · 1.17 KB
/
Logger.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
local Logger = ArenaLog.Logger
Logger.types = {
error = {
msg = "ERROR",
color = "cffff0000"
},
warning = {
msg = "WARNING",
color = "cfffff000"
},
info = {
msg = "INFO",
color = "cff00ff00"
},
debug = {
msg = "DEBUG",
color = "cff00ff00"
}
}
local function CheckFormat(msg, ...)
if ... then
msg = string.format(msg, ...)
end
return msg
end
function Logger:_log(type, msg, ...)
local formatedMsg = CheckFormat(msg, ...)
local source = Logger.types
print(string.format("|%sArenaLog [%s]|r: %s", source[type].color, source[type].msg, formatedMsg))
end
function Logger:Error(msg, ...)
if ArenaLog.db.char.loggerModes.error then
self:_log("error", msg, ...)
end
end
function Logger:Warning(msg, ...)
if ArenaLog.db.char.loggerModes.warning then
self:_log("warning", msg, ...)
end
end
function Logger:Info(msg, ...)
if ArenaLog.db.char.loggerModes.info then
self:_log("info", msg, ...)
end
end
function Logger:Debug(msg, ...)
if ArenaLog.db.char.loggerModes.debug then
self:_log("debug", msg, ...)
end
end