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,13 +19,20 @@ async fn index() -> Result<&'static str, MyError> {
|
||||
Err(err)
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
std::env::set_var("RUST_LOG", "my_errors=debug,actix_web=info");
|
||||
std::env::set_var("RUST_BACKTRACE", "1");
|
||||
env_logger::init();
|
||||
|
||||
HttpServer::new(|| App::new().wrap(Logger::default()).service(index))
|
||||
HttpServer::new(|| {
|
||||
let logger = Logger::default();
|
||||
|
||||
App::new()
|
||||
.wrap(logger)
|
||||
.service(index)
|
||||
})
|
||||
.bind("127.0.0.1:8080")?
|
||||
.run()
|
||||
.await
|
||||
|
Loading…
x
Reference in New Issue
Block a user