Log through a GameLog autoload instead of print()

GameLog.debug() prints only in debug builds, and GameLog.warning() reports
problems such as unexpected server data or failed downloads.
This commit is contained in:
Sansan committed 2026-10-06 11:15:03 +02:00
1 parent 5cdec5cc8f
commit 5831e1e73d
20 files changed
+137 -89

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
extends GdUnitTestSuite
## GameLog joins its arguments like print() does.
func test_joins_parts_without_spaces_like_print() -> void:
assert_str(GameLog._join(["Song ", 3, " of ", 10.5])).is_equal("Song 3 of 10.5")
func test_joins_any_kind_of_value() -> void:
assert_str(GameLog._join([null, true, [1, 2], {"a": 1}])) \
.is_equal("<null>true[1, 2]{ \"a\": 1 }")
func test_no_parts_gives_an_empty_line() -> void:
assert_str(GameLog._join([])).is_empty()
func test_debug_takes_any_number_of_arguments() -> void:
GameLog.debug()
GameLog.debug("one")
GameLog.debug("one", 2, Vector2.ONE)
# Reaching this line means none of the calls failed
assert_bool(true).is_true()
+1
View File
@@ -0,0 +1 @@
uid://delnqk8yt0hes