Skip to content

Commit d566ee7

Browse files
Jonathan Woollett-LightJonathanWoollett-Light
authored andcommitted
refactor: Inline log_received_api_request
Inlines the `log_received_api_request` function as it very small and only called once. This reduces indirection to simply the code. Signed-off-by: Jonathan Woollett-Light <[email protected]>
1 parent bd87a91 commit d566ee7

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/api_server/src/parsed_request.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,12 @@ impl TryFrom<&Request> for ParsedRequest {
6262
type Error = Error;
6363
fn try_from(request: &Request) -> Result<Self, Self::Error> {
6464
let request_uri = request.uri().get_abs_path().to_string();
65-
log_received_api_request(describe(
65+
let description = describe(
6666
request.method(),
6767
request_uri.as_str(),
6868
request.body.as_ref(),
69-
));
69+
);
70+
info!("The API server received a {description}.");
7071

7172
// Split request uri by '/' by doing:
7273
// 1. Trim starting '/' characters
@@ -207,14 +208,6 @@ impl ParsedRequest {
207208
}
208209
}
209210

210-
/// Helper function for writing the received API requests to the log.
211-
///
212-
/// The `info` macro is used for logging.
213-
#[inline]
214-
fn log_received_api_request(api_description: String) {
215-
info!("The API server received a {}.", api_description);
216-
}
217-
218211
/// Helper function for metric-logging purposes on API requests.
219212
///
220213
/// # Arguments

0 commit comments

Comments
 (0)