-
Notifications
You must be signed in to change notification settings - Fork 8
/
log.lua
42 lines (33 loc) · 830 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
38
39
40
41
42
l = {}
l.LEVEL_DEBUG = 0
l.LEVEL_INFO = 1
l.LEVEL_WARN = 2
l.LEVEL_ERROR = 3
l.printLevel = l.LEVEL_WARN
l.logLevel = l.LEVEL_INFO
function l.print_at_level(str, level)
if (l.printLevel <= level) then
game.print("[OutpostPlanner] " .. str)
end
end
function l.log_at_level(str, level)
if (l.printLevel <= level) then
log(str)
end
end
function l.out_at_level(str, level)
l.print_at_level(str, level)
l.log_at_level(str, level)
end
function l.debug(str)
l.out_at_level("Debug: " .. str, l.LEVEL_DEBUG)
end
function l.info(str)
l.out_at_level("Info: " .. str, l.LEVEL_INFO)
end
function l.warn(str)
l.out_at_level("Warn: " .. str, l.LEVEL_WARN)
end
function l.error(str)
l.out_at_level("Error: " .. str, l.LEVEL_ERROR)
end