debug log

This commit is contained in:
Nordup 2023-06-02 00:10:17 +03:00
parent 48feba5041
commit 7348f2b9d5
3 changed files with 8 additions and 6 deletions

View file

@ -18,3 +18,5 @@ func logclr(msg, color: Color) -> void:
var rich_clr = "[color=%s]%s[/color]" % [color.to_html(), str(msg)] var rich_clr = "[color=%s]%s[/color]" % [color.to_html(), str(msg)]
print_rich(rich_clr) print_rich(rich_clr)
logged.emit(rich_clr) logged.emit(rich_clr)
# TODO: log category with defined color

View file

@ -14,17 +14,17 @@ func _physics_process(_delta: float) -> void:
func _execute_function(command: Command) -> Variant: func _execute_function(command: Command) -> Variant:
print("Recieved command: " + command.name) Debug.logclr("Recieved command: " + command.name, Color.SANDY_BROWN)
match command.name: match command.name:
"send_filehandle": "send_filehandle":
command_events.send_filehandle_emit() command_events.send_filehandle_emit()
"set_mouse_mode": "set_mouse_mode":
if command.args.size() != 1: push_error("Arg count should be 1"); return "" if command.args.size() != 1: Debug.logerr("Arg count should be 1"); return ""
command_events.set_mouse_mode_emit(command.args[0]) command_events.set_mouse_mode_emit(command.args[0])
"open_gate": "open_gate":
if command.args.size() != 1: push_error("Arg count should be 1"); return "" if command.args.size() != 1: Debug.logerr("Arg count should be 1"); return ""
var url = Url.join(gate_events.current_gate_url, command.args[0]) var url = Url.join(gate_events.current_gate_url, command.args[0])
gate_events.open_gate_emit(url) gate_events.open_gate_emit(url)
_: _:
print("Command %s not implemented" % [command.name]) Debug.logerr("Command %s not implemented" % [command.name])
return "" return ""

View file

@ -54,12 +54,12 @@ func create_external_texture() -> void:
func send_filehandle() -> void: func send_filehandle() -> void:
print("Sending send_filehandle...") Debug.logr("Sending send_filehandle...")
var sent = false var sent = false
while not sent: while not sent:
sent = ext_texure.send_filehandle(fd_path) sent = ext_texure.send_filehandle(fd_path)
await get_tree().create_timer(0.1).timeout await get_tree().create_timer(0.1).timeout
print("fd was sent") Debug.logr("filehandle was sent")
func _process(_delta: float) -> void: func _process(_delta: float) -> void: