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,