mirror of
https://github.com/actix/actix-website
synced 2025-01-22 16:15:56 +01:00
Errors: split code lines to make where logger is wrapped clearer (#218)
This commit is contained in:
parent
501d52b485
commit
d148e3e437
@ -19,15 +19,22 @@ async fn index() -> Result<&'static str, MyError> {
|
|||||||
Err(err)
|
Err(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
std::env::set_var("RUST_LOG", "my_errors=debug,actix_web=info");
|
std::env::set_var("RUST_LOG", "my_errors=debug,actix_web=info");
|
||||||
std::env::set_var("RUST_BACKTRACE", "1");
|
std::env::set_var("RUST_BACKTRACE", "1");
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
|
|
||||||
HttpServer::new(|| App::new().wrap(Logger::default()).service(index))
|
HttpServer::new(|| {
|
||||||
.bind("127.0.0.1:8080")?
|
let logger = Logger::default();
|
||||||
.run()
|
|
||||||
.await
|
App::new()
|
||||||
|
.wrap(logger)
|
||||||
|
.service(index)
|
||||||
|
})
|
||||||
|
.bind("127.0.0.1:8080")?
|
||||||
|
.run()
|
||||||
|
.await
|
||||||
}
|
}
|
||||||
// </logging>
|
// </logging>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user