From 2bf7823f2126403adb8a716b1ee34290ed22bf75 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Fri, 27 Mar 2026 13:49:27 +0100 Subject: [PATCH] Enhance command processing with detailed debug logging Added comprehensive debug logging to the `process_text_command` function, providing insights into raw command payloads, parsed command types, and error details when debugging is enabled. This update improves troubleshooting capabilities by offering clearer visibility into command handling and potential parsing issues. --- src/commands.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/commands.rs b/src/commands.rs index 996d79b..5d82412 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -21,11 +21,30 @@ pub async fn process_text_command( if trimmed.is_empty() { return; } + if room_debug_enabled() { + eprintln!( + "[yourchat2][room-debug][raw] client_id={client_id} payload={}", + trimmed + ); + } match serde_json::from_str::(trimmed) { Ok(command) => { + if room_debug_enabled() { + let command_type = command_name(&command); + eprintln!( + "[yourchat2][room-debug][parsed] client_id={client_id} type='{}' room={:?} name={:?}", + command_type, command.room, command.name + ); + } handle_command(client_id, command, state, config).await; } Err(err) => { + if room_debug_enabled() { + eprintln!( + "[yourchat2][room-debug][parse-error] client_id={client_id} error='{}' payload={}", + err, trimmed + ); + } state::send_to_client( client_id, state,