This commit is contained in:
jdeepee 2020-10-21 19:45:40 +01:00
parent b78dd3a0e1
commit 91eb626163
1 changed files with 3 additions and 4 deletions

View File

@ -126,7 +126,7 @@ impl Logger {
self self
} }
/// Register a closure to be run on the request output of the logger. /// Register a closure to be run on the request output of the logger.
/// Note: output from closure will be present at end of logger output. Multiple closure will be ran in the order they are registed. /// Note: output from closure will be present at end of logger output. Multiple closure will be ran in the order they are registed.
pub fn register_request_closure( pub fn register_request_closure(
mut self, mut self,
@ -733,7 +733,7 @@ mod tests {
)) ))
}; };
let logger = Logger::new("%% %{User-Agent}i %{X-Test}o %{HOME}e %D test") let logger = Logger::new("%% %{User-Agent}i %{X-Test}o %{HOME}e %D test")
.register_closure(|_req: &ServiceRequest| -> String { .register_request_closure(|_req: &ServiceRequest| -> String {
String::from("custom_log") String::from("custom_log")
}); });
@ -744,7 +744,6 @@ mod tests {
header::HeaderValue::from_static("ACTIX-WEB"), header::HeaderValue::from_static("ACTIX-WEB"),
) )
.to_srv_request(); .to_srv_request();
let res = srv.call(req).await; let _res = srv.call(req).await;
println!("{:?}", res);
} }
} }