-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog.lua
More file actions
47 lines (42 loc) · 1.12 KB
/
Copy pathlog.lua
File metadata and controls
47 lines (42 loc) · 1.12 KB
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
local log = {
color = {
red = function(s)
return "\027[31m" .. s .. "\027[0m"
end,
green = function(s)
return "\027[32m" .. s .. "\027[0m"
end,
yellow = function(s)
return "\027[33m" .. s .. "\027[0m"
end,
blue = function(s)
return "\027[34m" .. s .. "\027[0m"
end,
magenta = function(s)
return "\027[35m" .. s .. "\027[0m"
end,
cyan = function(s)
return "\027[36m" .. s .. "\027[0m"
end,
white = function(s)
return "\027[37m" .. s .. "\027[0m"
end,
},
}
function log.info(fmt, ...)
print(string.format(log.color.blue("[info] ") .. fmt, ...))
end
function log.warn(fmt, ...)
print(string.format(log.color.yellow("[warn] ") .. fmt, ...))
end
function log.error(fmt, ...)
print(string.format(log.color.red("[err!] ") .. fmt, ...))
end
if os.getenv("BORING_DEBUG") then
function log.debug(fmt, ...)
print(string.format(log.color.cyan("[debug] ") .. fmt, ...))
end
else
log.debug = function() end
end
return log