Clean up SweetLogger prints by making file and functions arguments automatic
This commit is contained in:
@@ -1419,11 +1419,11 @@ func _open_log() -> void:
|
||||
path = OS.get_environment("TEMP").path_join("vryhungry_mptest_%s.log" % role)
|
||||
_log_file = FileAccess.open(path, FileAccess.WRITE)
|
||||
_log_path = ProjectSettings.globalize_path(path)
|
||||
SweetLogger.info("[MPTEST] step log -> {0}", [_log_path], "mp_test_driver.gd", "_open_log")
|
||||
SweetLogger.info("[MPTEST] step log -> {0}", [_log_path])
|
||||
|
||||
|
||||
func _log(s: String) -> void:
|
||||
SweetLogger.info("[MPTEST {0}] {1}", [_role, s], "mp_test_driver.gd", "_log")
|
||||
SweetLogger.info("[MPTEST {0}] {1}", [_role, s])
|
||||
if _log_file:
|
||||
_log_file.store_line(s)
|
||||
_log_file.flush()
|
||||
|
||||
@@ -42,7 +42,7 @@ func _run() -> void:
|
||||
_clear_previous_results(logs_dir)
|
||||
|
||||
print_rich("[b]Running the multiplayer test suite...[/b]")
|
||||
SweetLogger.info("the editor will be unresponsive until it finishes (~2 minutes)", [], "run_tests_in_editor.gd", "_run")
|
||||
SweetLogger.info("the editor will be unresponsive until it finishes (~2 minutes)", [])
|
||||
|
||||
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):
|
||||
SweetLogger.warning("timed out after {0}s, stopping the instances", [TIMEOUT_SEC], "run_tests_in_editor.gd", "_run")
|
||||
SweetLogger.warning("timed out after {0}s, stopping the instances", [TIMEOUT_SEC])
|
||||
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)
|
||||
SweetLogger.info("", [], "run_tests_in_editor.gd", "_print_report")
|
||||
SweetLogger.info("", [])
|
||||
# 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:
|
||||
SweetLogger.info("{0}", [line], "run_tests_in_editor.gd", "_print_report")
|
||||
SweetLogger.info("report: {0}", [path], "run_tests_in_editor.gd", "_print_report")
|
||||
SweetLogger.info("{0}", [line])
|
||||
SweetLogger.info("report: {0}", [path])
|
||||
|
||||
|
||||
func _build_gif(project_dir: String, logs_dir: String) -> void:
|
||||
|
||||
@@ -3,8 +3,8 @@ extends Node
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
SweetLogger.debug("stations: {0}", [get_stations()], "testworldLoad.gd", "_ready")
|
||||
SweetLogger.debug("items: {0}", [get_items()], "testworldLoad.gd", "_ready")
|
||||
SweetLogger.debug("stations: {0}", [get_stations()])
|
||||
SweetLogger.debug("items: {0}", [get_items()])
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user