mirror of
https://github.com/actix/actix-website
synced 2024-11-24 16:52:59 +01:00
21 lines
451 B
Rust
21 lines
451 B
Rust
// <logger>
|
|
use actix_web::middleware::Logger;
|
|
use env_logger::Env;
|
|
|
|
#[actix_web::main]
|
|
async fn main() -> std::io::Result<()> {
|
|
use actix_web::{App, HttpServer};
|
|
|
|
env_logger::init_from_env(Env::default().default_filter_or("info"));
|
|
|
|
HttpServer::new(|| {
|
|
App::new()
|
|
.wrap(Logger::default())
|
|
.wrap(Logger::new("%a %{User-Agent}i"))
|
|
})
|
|
.bind(("127.0.0.1", 8080))?
|
|
.run()
|
|
.await
|
|
}
|
|
// </logger>
|