Change log levels and add more logging

This commit is contained in:
JonShard
2026-08-20 09:53:09 +02:00
parent 06dde91468
commit 655751e5bd
7 changed files with 34 additions and 25 deletions
+2 -1
View File
@@ -73,11 +73,12 @@ func _on_body_entered(body: Node3D) -> void:
# Instantiate the result of combination and free the two ingredient items # Instantiate the result of combination and free the two ingredient items
func _combine(other_body: Node3D, result: PackedScene) -> void: func _combine(other_body: Node3D, result: PackedScene) -> void:
SweetLogger.debug("Combining {0} + {1} into {2}", [_food_item.id, Helper.find_food_item(other_body).id, result.resource_path]) SweetLogger.info("Combining {0} + {1} into {2}", [_food_item.id, Helper.find_food_item(other_body).id, result.resource_path])
# Get Snapzone # Get Snapzone
var snap_zone := _pickable.get_picked_up_by() var snap_zone := _pickable.get_picked_up_by()
if not snap_zone or not snap_zone.has_method("pick_up_object"): if not snap_zone or not snap_zone.has_method("pick_up_object"):
SweetLogger.warning("{0}: combine triggered but base item is not in a snap zone, aborting", [_pickable.name])
return return
# Spawn the result through the server (so it replicates to every peer, # Spawn the result through the server (so it replicates to every peer,
+1 -1
View File
@@ -50,7 +50,7 @@ func _process(delta: float) -> void:
#print("DayController: customers_at_this_time: ", customers_at_this_time) #print("DayController: customers_at_this_time: ", customers_at_this_time)
if customers_spawned < customers_at_this_time: if customers_spawned < customers_at_this_time:
customers_spawned += 1 customers_spawned += 1
SweetLogger.debug("Spawning customer") SweetLogger.info("Spawning customer")
Signals.request_customer_spawn.emit() Signals.request_customer_spawn.emit()
# If day complete # If day complete
if GameManager.customers_per_day == customers_served and customers_spawned == GameManager.customers_per_day: if GameManager.customers_per_day == customers_served and customers_spawned == GameManager.customers_per_day:
+2 -2
View File
@@ -147,7 +147,7 @@ func _enter_tree() -> void:
sync_config.add_property(property_path) sync_config.add_property(property_path)
sync_config.property_set_spawn(property_path, false) sync_config.property_set_spawn(property_path, false)
sync_config.property_set_replication_mode(property_path, SceneReplicationConfig.REPLICATION_MODE_ON_CHANGE) sync_config.property_set_replication_mode(property_path, SceneReplicationConfig.REPLICATION_MODE_ON_CHANGE)
SweetLogger.info("DEBUG sync_config properties: {0} | root_path: {1} | authority: {2} | peer: {3}", [sync_config.get_properties(), synchronizer.root_path, get_multiplayer_authority(), multiplayer.get_unique_id()]) # temp diagnostic SweetLogger.debug("sync_config properties: {0} | root_path: {1} | authority: {2} | peer: {3}", [sync_config.get_properties(), synchronizer.root_path, get_multiplayer_authority(), multiplayer.get_unique_id()])
func _ready() -> void: func _ready() -> void:
@@ -241,7 +241,6 @@ func _absorb_item_if_correct(_item: Node) -> void:
# Plate: Get plate controller in child of _item (hopefully a plate XRpickable) # Plate: Get plate controller in child of _item (hopefully a plate XRpickable)
var plate_controller = _get_plate_controller_from_item(_item) var plate_controller = _get_plate_controller_from_item(_item)
SweetLogger.debug("Plate_controller ref: {0}", [plate_controller]) SweetLogger.debug("Plate_controller ref: {0}", [plate_controller])
_item.print_tree_pretty()
if plate_controller: if plate_controller:
# Absorm items from the plate we want # Absorm items from the plate we want
@@ -361,6 +360,7 @@ func _state_end(oldState: TableState):
_set_state(TableState.EMPTY) _set_state(TableState.EMPTY)
TableState.ORDERING, TableState.WAITING_PRIMARY, TableState.WAITING_FRIEND: TableState.ORDERING, TableState.WAITING_PRIMARY, TableState.WAITING_FRIEND:
SweetLogger.info("{0}: order timed out in state {1}, game over", [name, TableState.keys()[oldState]])
label_3d.text = lbl_gameover label_3d.text = lbl_gameover
GameManager.game_over() GameManager.game_over()
+1 -1
View File
@@ -21,7 +21,7 @@ func _process(_delta: float) -> void:
func _on_button_pressed() -> void: func _on_button_pressed() -> void:
SweetLogger.debug("Buy {0}", [station_name]) SweetLogger.info("Buy {0}", [station_name])
_buy_station() _buy_station()
+3 -3
View File
@@ -20,7 +20,7 @@ var sync_config: SceneReplicationConfig
var enabled: bool: # When disabled the station only updated display and sounds. var enabled: bool: # When disabled the station only updated display and sounds.
get: return snap_zone.enabled get: return snap_zone.enabled
set(p_enabled): set(p_enabled):
SweetLogger.info("Set enabled {0} on station {1} on client {2}", [p_enabled, name, multiplayer.get_unique_id()]) SweetLogger.debug("Set enabled {0} on station {1} on client {2}", [p_enabled, name, multiplayer.get_unique_id()])
snap_zone.enabled = p_enabled snap_zone.enabled = p_enabled
snap_zone.set_process(p_enabled) snap_zone.set_process(p_enabled)
@@ -75,7 +75,7 @@ func _on_object_dropped_handler(item: Node3D) -> void:
func _apply_object_picked_up(item: Node3D) -> void: func _apply_object_picked_up(item: Node3D) -> void:
SweetLogger.debug("Pickup: {0}", [item.name]) SweetLogger.info("{0}: Pickup: {1}", [name, item.name])
Helper.play_sound(notification_audio, pickup_sound) Helper.play_sound(notification_audio, pickup_sound)
on_object_picked_up(item) on_object_picked_up(item)
var food_item = Helper.find_food_item(item) var food_item = Helper.find_food_item(item)
@@ -85,7 +85,7 @@ func _apply_object_picked_up(item: Node3D) -> void:
func _apply_object_dropped(item: Node3D) -> void: func _apply_object_dropped(item: Node3D) -> void:
Helper.play_sound(notification_audio, drop_sound, 0.8) Helper.play_sound(notification_audio, drop_sound, 0.8)
SweetLogger.debug("Drop: {0}", [item.name]) SweetLogger.info("{0}: Drop: {1}", [name, item.name])
on_object_dropped(item) on_object_dropped(item)
var food_item = Helper.find_food_item(item) var food_item = Helper.find_food_item(item)
if food_item: if food_item:
+9 -3
View File
@@ -20,9 +20,15 @@ static func load_recipes() -> void:
return return
var yaml_available := ClassDB.class_exists("YAML") var yaml_available := ClassDB.class_exists("YAML")
if yaml_available: if not yaml_available:
SweetLogger.error("YAML addon is not available, recipes.yaml can not be loaded")
return
var result = ClassDB.class_call_static("YAML", "load_file", recipe_path) var result = ClassDB.class_call_static("YAML", "load_file", recipe_path)
if result != null and not result.has_error(): if result == null or result.has_error():
SweetLogger.error("Failed to parse recipes.yaml: {0}", [result.get_error_message() if result else "null result"])
return
var data = result.get_data() var data = result.get_data()
if typeof(data) != TYPE_DICTIONARY: if typeof(data) != TYPE_DICTIONARY:
SweetLogger.warning("YAML addon parsed recipes.yaml but returned an unsupported structure") SweetLogger.warning("YAML addon parsed recipes.yaml but returned an unsupported structure")
@@ -35,7 +41,7 @@ static func load_recipes() -> void:
_build_rolling_map() _build_rolling_map()
_build_augmenting_map() _build_augmenting_map()
_loaded = true _loaded = true
#print_all_recipes()
static func get_combination_result(first_id: StringName, second_id: StringName) -> PackedScene: static func get_combination_result(first_id: StringName, second_id: StringName) -> PackedScene:
load_recipes() load_recipes()
+2
View File
@@ -15,10 +15,12 @@ func _unhandled_input(event: InputEvent) -> void:
# Kill all clients # Kill all clients
@rpc("any_peer", "call_local", "reliable") @rpc("any_peer", "call_local", "reliable")
func all_quit_game(): func all_quit_game():
SweetLogger.info("Quit game requested, killing all clients")
get_tree().quit() get_tree().quit()
# Finds any node of class/type Table and calls satisfyAllOrders() # Finds any node of class/type Table and calls satisfyAllOrders()
func satisfy_table_orders() -> void: func satisfy_table_orders() -> void:
SweetLogger.info("Debug: satisfying all table orders")
# Searches all nodes in the current running scene matching the class "Table" # Searches all nodes in the current running scene matching the class "Table"
var table_nodes = get_tree().root.find_children("*", "Table", true, false) var table_nodes = get_tree().root.find_children("*", "Table", true, false)