-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogger.gd
More file actions
51 lines (44 loc) · 1.02 KB
/
Copy pathLogger.gd
File metadata and controls
51 lines (44 loc) · 1.02 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
48
49
50
51
@tool
extends Node
func get_func_name() -> String:
var stack := get_stack()
if stack.size() <= 2:
return ""
var out_func_info = stack[2]
var path:String = out_func_info.source
path = path.split("/")[-1]
var info = "[%s:%d:%s]" % [path, out_func_info.line, out_func_info.function]
return info
func print_info(info):
var infos:Array
match typeof(info):
TYPE_ARRAY:
infos = info
_:
infos = [info]
infos.push_front(get_func_name())
print.bindv(infos).call()
func print_warn(info):
var infos:Array
match typeof(info):
TYPE_ARRAY:
infos = info
_:
infos = [info]
infos.push_front(get_func_name())
infos.push_front("[color=yellow]")
infos.push_back("[/color]")
#push_warning.bindv(infos).call()
print_rich.bindv(infos).call()
func print_error(info):
var infos:Array
match typeof(info):
TYPE_ARRAY:
infos = info
_:
infos = [info]
infos.push_front(get_func_name())
infos.push_front("[color=red]")
infos.push_back("[/color]")
#push_error.bindv(infos).call()
print_rich.bindv(infos).call()