You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: logging.rs
    path of file: ./repos/rust-template/rust/src.axum/middleware
    
    the code of the file until where you have to start completion: //! Middleware for logging requests/responses for server and client calls.

use crate::{error::AppError, middleware::request_ext::RequestExt, settings::AppEnvironment};
use anyhow::{anyhow, Result};
use async_trait::async_trait;
use axum::{
    body::{Body, BoxBody, Bytes},
    http::{Request, StatusCode},
    middleware::Next,
    response::{IntoResponse, Response},
};
use http::header;
use reqwest_middleware::Middleware as ReqwestMiddleware;
use task_local_extensions::Extensions;
use traci
    
    async fn log_request(request: Request<Body>) -> Result<Request<Body>, AppError> {
        let path = request.path();
        let (parts, body) = request.into_parts();

        debug!(
            subject = "request",
            category="http.request",
            msg = "started processing request",
            request_path = %path,
            query_string = parts.uri.query());

        let bytes = buffer("Request", body).await?;
        if let Ok(body) = std::str::from_utf8(&bytes) {
            debug!(subject="request", category="http.request", body=?body, request_path=%path);
        }
        let req = Request::from_parts(parts, Body::from(bytes));
        Ok(req)
    }