| Crates.io | axum_log_util |
| lib.rs | axum_log_util |
| version | 0.1.0 |
| created_at | 2025-07-03 11:31:39.540336+00 |
| updated_at | 2025-07-03 11:31:39.540336+00 |
| description | A procedural macro crate for automatic logging of Axum HTTP request handlers |
| homepage | https://github.com/Matze99/axum-log-util |
| repository | https://github.com/Matze99/axum-log-util |
| max_upload_size | |
| id | 1736156 |
| size | 8,269 |
A Rust procedural macro crate that provides logging utilities for HTTP request handlers.
axum_log_util is a procedural macro crate designed to automatically add
logging capabilities to async HTTP request handler functions. It wraps functions
with logging statements that record when endpoints are executed and their
response status codes.
Add the #[log_request] attribute to your async HTTP handler functions:
use axum_log_util::log_request;
#[log_request]
pub async fn my_endpoint() -> Response {
// Your endpoint logic here
Response::new()
}
The macro transforms your function to include logging statements:
"Executing Endpoint: {function_name}""{status_code}: Endpoint {function_name}"INFO: Executing Endpoint: my_endpoint
INFO: 200 OK: Endpoint my_endpoint
syn (v2.0): For parsing Rust syntaxquote (v1.0): For generating Rust codeproc-macro: Standard library for procedural macrosThis crate is a procedural macro library (proc-macro = true) that operates at
compile time to transform your functions. It:
synquote!async and return a Response typelog, tracing, etc.) to be configured in
your applicationTo test the macro:
cargo test
To see the expanded macro output:
cargo expand