24 stable releases (9 major)

11.0.0 Sep 29, 2024
10.0.2 Sep 28, 2024
8.0.1 Aug 15, 2024
7.0.0 Aug 14, 2024
1.0.2 Nov 11, 2022

#261 in Debugging

Download history 18/week @ 2024-09-13 234/week @ 2024-09-20 472/week @ 2024-09-27 40/week @ 2024-10-04 15/week @ 2024-10-11 4/week @ 2024-10-18 4/week @ 2024-11-01 1/week @ 2024-11-08 3/week @ 2024-11-15 1/week @ 2024-11-22 115/week @ 2024-12-06

119 downloads per month
Used in 2 crates

Apache-2.0

170KB
4.5K SLoC

iceyee_logger

Supported Os

  • linux
  • macos
  • windows

Example

#[tokio::test]
pub async fn test_logger_no_project() {
    use iceyee_logger::Level;
    use iceyee_logger::Logger;
    use iceyee_timer::Timer;
    use std::sync::Arc;
    use tokio::sync::Mutex;
    println!("");
    let logger: Logger = Logger::new(Some(Level::Info), None, None).await;
    logger.debug("hello world.").await;
    logger.info("hello world.").await;
    logger.warn("hello world.").await;
    logger.error("hello world.").await;
    let logger: Arc<Mutex<Logger>> = Arc::new(Mutex::new(logger));
    let logger_clone = logger.clone();
    tokio::task::spawn(async move {
        let mut counter: usize = 0;
        loop {
            counter += 1;
            let message = counter.to_string();
            let logger = logger_clone.lock().await;
            logger.debug(message.as_str()).await;
            logger.info(message.as_str()).await;
            logger.warn(message.as_str()).await;
            logger.error(message.as_str()).await;
            Timer::sleep(3_000).await;
        }
    });
    Timer::sleep(10_000).await;
    drop(logger);
    Timer::sleep(2_000).await;
    println!("");
    return;
}
test test_logger_project_2 ...

2023-11-16T12:10:40.543+08:00 INFO  # hello world.

2023-11-16T12:10:40.543+08:00 WARN  # hello world.

2023-11-16T12:10:40.543+08:00 ERROR #
    hello world.

2023-11-16T12:10:40.543+08:00 INFO  # 1

2023-11-16T12:10:40.543+08:00 WARN  # 1

2023-11-16T12:10:40.543+08:00 ERROR #
    1

2023-11-16T12:10:43.513+08:00 INFO  # 2

2023-11-16T12:10:43.513+08:00 WARN  # 2

2023-11-16T12:10:43.513+08:00 ERROR #
    2

2023-11-16T12:10:46.543+08:00 INFO  # 3

2023-11-16T12:10:46.543+08:00 WARN  # 3

2023-11-16T12:10:46.543+08:00 ERROR #
    3

2023-11-16T12:10:49.514+08:00 INFO  # 4

2023-11-16T12:10:49.514+08:00 WARN  # 4

2023-11-16T12:10:49.514+08:00 ERROR #
    4

Dependencies

~2.4–8MB
~58K SLoC