rakhas_logger 0.1.0

Async logging library with batch processing and graceful shutdown
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use chrono::Utc;
use chrono_tz::Tz;

pub async fn format_log_message(message: &str, timezone: &Tz, is_error: bool) -> String {
    let time_now = Utc::now().with_timezone(timezone);
    let formatted_time = time_now.format("%Y-%m-%d %H:%M:%S");

    if !is_error {
        format!("[{}]: {}\n", formatted_time, message)
    } else {
        format!("!![{}]: {}!!\n", formatted_time, message)
    }
}