zlsrs 0.1.6

Rust 标准库扩展工具集,提供更便捷的使用方式
Documentation
use crate::zlog;

#[test]
fn test_init() {
    zlog::init(None);
    zlog::warn!("test");
}

#[test]
fn test_init_options() {
    zlog::init(zlog::Options {
        level: zlog::Level::INFO,
        // set_file: "test.log".to_string(),
        time_format: "[month]/[day] [hour repr:24]:[minute]:[second]".to_string(),
        show_line_number: true,
        ..Default::default()
    });
    zlog::warn!("test");
}

#[test]
fn test_instrument() {
    zlog::init(None);
    process_request(1);
    process_request(9);
}

#[zlog::instrument]
fn process_request(user_id: u64) {
    zlog::info!("开始处理用户请求");

    zlog::warn!("[{user_id}]处理中...");

    zlog::info!("请求处理完成");
}