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

22 lines
420 B
Rust
Raw Normal View History

2019-06-17 22:57:57 +02:00
// <logger>
use actix_web::middleware::Logger;
use env_logger;
pub fn main() {
2019-06-26 08:59:20 +02:00
use actix_web::{App, HttpServer};
2019-06-17 22:57:57 +02:00
std::env::set_var("RUST_LOG", "actix_web=info");
env_logger::init();
2019-06-26 08:59:20 +02:00
HttpServer::new(|| {
App::new()
.wrap(Logger::default())
.wrap(Logger::new("%a %{User-Agent}i"))
})
.bind("127.0.0.1:8088")
.unwrap()
.run()
.unwrap();
2019-06-17 22:57:57 +02:00
}
// </logger>