Added color support for logger
This commit is contained in:
parent
31f854c5c6
commit
0392cfd147
1 changed files with 16 additions and 16 deletions
32
logger.gd
32
logger.gd
|
@ -31,43 +31,43 @@ func _ready() -> void:
|
|||
func diag(script:String,message:String,preproc:bool = false) -> void:
|
||||
if enable and enable_diag:
|
||||
if preproc:
|
||||
var logmsg = "(" + script + ") [DIAG] " + preprocessor.pre(0,script,message)
|
||||
print(logmsg)
|
||||
var logmsg = "[gray](" + script + ") [DIAG] [b]" + preprocessor.pre(0,script,message) + "[/b]"
|
||||
print_rich(logmsg)
|
||||
emit_signal("logevent","DIAG",script,message,logmsg)
|
||||
else:
|
||||
var logmsg = "(" + script + ") [DIAG] " + message
|
||||
print(logmsg)
|
||||
var logmsg = "[gray](" + script + ") [DIAG] [b]" + message + "[/b]"
|
||||
print_rich(logmsg)
|
||||
emit_signal("logevent","DIAG",script,message,logmsg)
|
||||
|
||||
func info(script:String,message:String,preproc:bool = true) -> void:
|
||||
if enable:
|
||||
if preproc:
|
||||
var logmsg = "(" + script + ") [INFO] " + preprocessor.pre(1,script,message)
|
||||
print(logmsg)
|
||||
var logmsg = "(" + script + ") [INFO] [b]" + preprocessor.pre(1,script,message) + "[/b]"
|
||||
print_rich(logmsg)
|
||||
emit_signal("logevent","INFO",script,message,logmsg)
|
||||
else:
|
||||
var logmsg = "(" + script + ") [INFO] " + message
|
||||
print(logmsg)
|
||||
var logmsg = "(" + script + ") [INFO] [b]" + message + "[/b]"
|
||||
print_rich(logmsg)
|
||||
emit_signal("logevent","INFO",script,message,logmsg)
|
||||
|
||||
func warn(script:String,message:String,preproc:bool = true) -> void:
|
||||
if enable:
|
||||
if preproc:
|
||||
var logmsg = "(" + script + ") [WARN] " + preprocessor.pre(2,script,message)
|
||||
print(logmsg)
|
||||
var logmsg = "[orange](" + script + ") [WARN] [b]" + preprocessor.pre(2,script,message) + "[/b]"
|
||||
print_rich(logmsg)
|
||||
emit_signal("logevent","WARN",script,message,logmsg)
|
||||
else:
|
||||
var logmsg = "(" + script + ") [WARN] " + message
|
||||
print(logmsg)
|
||||
var logmsg = "[orange](" + script + ") [WARN] [b]" + message + "[/b]"
|
||||
print_rich(logmsg)
|
||||
emit_signal("logevent","WARN",script,message,logmsg)
|
||||
|
||||
func error(script:String,message:String,preproc:bool = true) -> void:
|
||||
if enable:
|
||||
if preproc:
|
||||
var logmsg = "(" + script + ") [ERROR] " + preprocessor.pre(3,script,message)
|
||||
print(logmsg)
|
||||
var logmsg = "[red](" + script + ") [ERROR] [b]" + preprocessor.pre(3,script,message) + "[/b]"
|
||||
print_rich(logmsg)
|
||||
emit_signal("logevent","ERROR",script,message,logmsg)
|
||||
else:
|
||||
var logmsg = "(" + script + ") [ERROR] " + message
|
||||
print(logmsg)
|
||||
var logmsg = "[red](" + script + ") [ERROR] [b]" + message + "[/b]"
|
||||
print_rich(logmsg)
|
||||
emit_signal("logevent","ERROR",script,message,logmsg)
|
||||
|
|
Loading…
Reference in a new issue