Implement configurable logging with tracing

- Replace eprintln! with tracing macros for configurable log levels
- Set up tracing_subscriber with level filtering from config
- Log format: YYYY-MM-DDTHH:MM:SSZ LEVEL IP "request" STATUS "message"
- Success logs: INFO level for 20 responses
- Error logs: WARN for 41/51, ERROR for 59
- Rate limiting and file serving now properly logged
- Remove unused RequestLogger::log_success method
This commit is contained in:
Jeena 2026-01-16 11:19:20 +00:00
parent 33ae576b25
commit 3865211554
3 changed files with 50 additions and 13 deletions

View file

@ -131,6 +131,7 @@ async fn main() {
loop {
let (stream, _) = listener.accept().await.unwrap();
tracing::debug!("Accepted connection from {}", stream.peer_addr().unwrap_or_else(|_| "unknown".parse().unwrap()));
let acceptor = acceptor.clone();
let dir = root.clone();
let expected_host = "localhost".to_string(); // Override for testing