Add Sweetlogger

This commit is contained in:
JonShard
2026-08-10 13:46:51 +02:00
parent bf31f85b02
commit 7648ecbac9
35 changed files with 608 additions and 223 deletions
+5 -5
View File
@@ -42,7 +42,7 @@ func _run() -> void:
_clear_previous_results(logs_dir)
print_rich("[b]Running the multiplayer test suite...[/b]")
print(" the editor will be unresponsive until it finishes (~2 minutes)")
SweetLogger.info("the editor will be unresponsive until it finishes (~2 minutes)", [], "run_tests_in_editor.gd", "_run")
var server_pid := _launch(exe, project_dir, ["--server"], SERVER_SCENE)
if server_pid <= 0:
@@ -61,7 +61,7 @@ func _run() -> void:
OS.delay_msec(500)
waited += 0.5
if OS.is_process_running(server_pid):
print(" timed out after %ds, stopping the instances" % TIMEOUT_SEC)
SweetLogger.warning("timed out after {0}s, stopping the instances", [TIMEOUT_SEC], "run_tests_in_editor.gd", "_run")
OS.kill(server_pid)
if OS.is_process_running(client_pid):
OS.kill(client_pid)
@@ -108,7 +108,7 @@ func _print_report(logs_dir: String) -> void:
push_error("No report at %s — the run did not finish. Check logs/mptest_server.log" % path)
return
var text := FileAccess.get_file_as_string(path)
print("")
SweetLogger.info("", [], "run_tests_in_editor.gd", "_print_report")
# Colour the summary so a failure is obvious in the Output panel.
for line in text.split("\n"):
if line.begins_with("FAIL") or line.contains("RESULT: FAILED"):
@@ -118,8 +118,8 @@ func _print_report(logs_dir: String) -> void:
elif line.begins_with("PASS"):
print_rich("[color=gray]%s[/color]" % line)
else:
print(line)
print("report: %s" % path)
SweetLogger.info("{0}", [line], "run_tests_in_editor.gd", "_print_report")
SweetLogger.info("report: {0}", [path], "run_tests_in_editor.gd", "_print_report")
func _build_gif(project_dir: String, logs_dir: String) -> void: