diff --git a/src/channels/web/handlers/users.rs b/src/channels/web/handlers/users.rs index eccf2882..c89c70a6 100644 --- a/src/channels/web/handlers/users.rs +++ b/src/channels/web/handlers/users.rs @@ -48,6 +48,7 @@ pub async fn users_create_handler( )); } + tracing::info!("users_create: passed validation, building record"); let user_id = Uuid::new_v4().to_string(); let now = chrono::Utc::now(); @@ -64,10 +65,15 @@ pub async fn users_create_handler( metadata: serde_json::json!({}), }; + tracing::info!("users_create: calling create_user for {}", user_id); store .create_user(&user_record) .await - .map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))?; + .map_err(|e| { + tracing::error!("users_create: create_user failed: {e}"); + (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()) + })?; + tracing::info!("users_create: create_user succeeded"); // Generate a first API token so the new user can authenticate immediately. // Hash the hex-encoded plaintext (what the user sends as Bearer token), @@ -78,10 +84,15 @@ pub async fn users_create_handler( let token_hash = crate::channels::web::auth::hash_token(&plaintext_token); let token_prefix = &plaintext_token[..8]; + tracing::info!("users_create: calling create_api_token"); let _token_record = store .create_api_token(&user_id, "initial", &token_hash, token_prefix, None) .await - .map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))?; + .map_err(|e| { + tracing::error!("users_create: create_api_token failed: {e}"); + (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()) + })?; + tracing::info!("users_create: complete, returning response"); Ok(Json(serde_json::json!({ "id": user_record.id,