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:
|
func diag(script:String,message:String,preproc:bool = false) -> void:
|
||||||
if enable and enable_diag:
|
if enable and enable_diag:
|
||||||
if preproc:
|
if preproc:
|
||||||
var logmsg = "(" + script + ") [DIAG] " + preprocessor.pre(0,script,message)
|
var logmsg = "[gray](" + script + ") [DIAG] [b]" + preprocessor.pre(0,script,message) + "[/b]"
|
||||||
print(logmsg)
|
print_rich(logmsg)
|
||||||
emit_signal("logevent","DIAG",script,message,logmsg)
|
emit_signal("logevent","DIAG",script,message,logmsg)
|
||||||
else:
|
else:
|
||||||
var logmsg = "(" + script + ") [DIAG] " + message
|
var logmsg = "[gray](" + script + ") [DIAG] [b]" + message + "[/b]"
|
||||||
print(logmsg)
|
print_rich(logmsg)
|
||||||
emit_signal("logevent","DIAG",script,message,logmsg)
|
emit_signal("logevent","DIAG",script,message,logmsg)
|
||||||
|
|
||||||
func info(script:String,message:String,preproc:bool = true) -> void:
|
func info(script:String,message:String,preproc:bool = true) -> void:
|
||||||
if enable:
|
if enable:
|
||||||
if preproc:
|
if preproc:
|
||||||
var logmsg = "(" + script + ") [INFO] " + preprocessor.pre(1,script,message)
|
var logmsg = "(" + script + ") [INFO] [b]" + preprocessor.pre(1,script,message) + "[/b]"
|
||||||
print(logmsg)
|
print_rich(logmsg)
|
||||||
emit_signal("logevent","INFO",script,message,logmsg)
|
emit_signal("logevent","INFO",script,message,logmsg)
|
||||||
else:
|
else:
|
||||||
var logmsg = "(" + script + ") [INFO] " + message
|
var logmsg = "(" + script + ") [INFO] [b]" + message + "[/b]"
|
||||||
print(logmsg)
|
print_rich(logmsg)
|
||||||
emit_signal("logevent","INFO",script,message,logmsg)
|
emit_signal("logevent","INFO",script,message,logmsg)
|
||||||
|
|
||||||
func warn(script:String,message:String,preproc:bool = true) -> void:
|
func warn(script:String,message:String,preproc:bool = true) -> void:
|
||||||
if enable:
|
if enable:
|
||||||
if preproc:
|
if preproc:
|
||||||
var logmsg = "(" + script + ") [WARN] " + preprocessor.pre(2,script,message)
|
var logmsg = "[orange](" + script + ") [WARN] [b]" + preprocessor.pre(2,script,message) + "[/b]"
|
||||||
print(logmsg)
|
print_rich(logmsg)
|
||||||
emit_signal("logevent","WARN",script,message,logmsg)
|
emit_signal("logevent","WARN",script,message,logmsg)
|
||||||
else:
|
else:
|
||||||
var logmsg = "(" + script + ") [WARN] " + message
|
var logmsg = "[orange](" + script + ") [WARN] [b]" + message + "[/b]"
|
||||||
print(logmsg)
|
print_rich(logmsg)
|
||||||
emit_signal("logevent","WARN",script,message,logmsg)
|
emit_signal("logevent","WARN",script,message,logmsg)
|
||||||
|
|
||||||
func error(script:String,message:String,preproc:bool = true) -> void:
|
func error(script:String,message:String,preproc:bool = true) -> void:
|
||||||
if enable:
|
if enable:
|
||||||
if preproc:
|
if preproc:
|
||||||
var logmsg = "(" + script + ") [ERROR] " + preprocessor.pre(3,script,message)
|
var logmsg = "[red](" + script + ") [ERROR] [b]" + preprocessor.pre(3,script,message) + "[/b]"
|
||||||
print(logmsg)
|
print_rich(logmsg)
|
||||||
emit_signal("logevent","ERROR",script,message,logmsg)
|
emit_signal("logevent","ERROR",script,message,logmsg)
|
||||||
else:
|
else:
|
||||||
var logmsg = "(" + script + ") [ERROR] " + message
|
var logmsg = "[red](" + script + ") [ERROR] [b]" + message + "[/b]"
|
||||||
print(logmsg)
|
print_rich(logmsg)
|
||||||
emit_signal("logevent","ERROR",script,message,logmsg)
|
emit_signal("logevent","ERROR",script,message,logmsg)
|
||||||
|
|
Loading…
Reference in a new issue