Skip to content

Commit

Permalink
Improve route map logging
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamRagstad committed Oct 15, 2023
1 parent 54ab19d commit 5b6ab5c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/engine/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,22 @@ impl WXRuntime {
Err(err) => error_code(format!("(Runtime) {}", err.message), err.code),
}
if self.mode == WXMode::Dev {
dbg!(&self.routes); // TODO: Remove this line
// Print the route map in dev mode.
info(self.mode, "Route map:");
let mut routes: Vec<(&Method, &WXUrlPath)> = self
.routes
.0
.iter()
.flat_map(|(method, method_map)| {
method_map
.iter()
.map(|(path, _)| (method, path))
.collect::<Vec<_>>()
})
.collect();
for (method, path) in routes {
println!(" - {} {}", method, path);
}
}
}

Expand Down

0 comments on commit 5b6ab5c

Please sign in to comment.