1
0
mirror of https://github.com/actix/actix-website synced 2024-11-25 01:02:58 +01:00
actix-website/examples/middleware/src/logger.rs
2019-12-29 02:03:17 +09:00

22 lines
446 B
Rust

// <logger>
use actix_web::middleware::Logger;
use env_logger;
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
use actix_web::{App, HttpServer};
std::env::set_var("RUST_LOG", "actix_web=info");
env_logger::init();
HttpServer::new(|| {
App::new()
.wrap(Logger::default())
.wrap(Logger::new("%a %{User-Agent}i"))
})
.bind("127.0.0.1:8088")?
.run()
.await
}
// </logger>