Skip to main content

rust_webx_host/
diagnostics.rs

1//! Route/handler startup diagnostics (uses tracing — host layer only).
2
3use rust_webx_core::route::diagnostics::{orphan_handlers, route_snapshots};
4
5/// Log route table and warn on orphan routes/handlers.
6pub fn log_startup_diagnostics() {
7    let routes = route_snapshots();
8    tracing::info!(count = routes.len(), "Registered HTTP routes");
9    for route in &routes {
10        if route.has_handler {
11            tracing::debug!(
12                method = %route.method,
13                path = route.path,
14                request = route.request_type,
15                response = route.response_type,
16                "route"
17            );
18        } else {
19            tracing::warn!(
20                method = %route.method,
21                path = route.path,
22                request = route.request_type,
23                "route has no #[handler] registration"
24            );
25        }
26    }
27
28    for handler in orphan_handlers() {
29        tracing::warn!(request = handler, "handler has no matching route");
30    }
31}