pub async fn log_with_context(
message: &str,
source: &str,
level: Level,
request_id: Option<String>,
user_id: Option<String>,
fields: Vec<(String, String)>,
) -> Result<(), GlobalError>Expand description
Log with context information This function logs messages with context information.
§Parameters
message: Message to be loggedsource: Source of the loglevel: Log levelrequest_id: Request IDuser_id: User IDfields: Additional fields
§Returns
Result indicating whether the operation was successful
§Example
use tracing_core::Level;
use rustfs_obs::log_with_context;
async fn example() {
let _ = log_with_context("This is an information message", "example", Level::INFO, Some("req-12345".to_string()), Some("user-6789".to_string()), vec![("endpoint".to_string(), "/api/v1/data".to_string())]).await;
}