17 stable releases (5 major)

6.0.0 Feb 9, 2024
5.0.0 Jan 29, 2024
4.2.0 Jan 4, 2024
4.1.0 Dec 28, 2023
1.0.2 Nov 11, 2022

#159 in Debugging

Download history 311/week @ 2023-12-18 334/week @ 2023-12-25 321/week @ 2024-01-01 14/week @ 2024-01-08 34/week @ 2024-01-15 22/week @ 2024-01-29 11/week @ 2024-02-05 1/week @ 2024-02-19 27/week @ 2024-02-26 33/week @ 2024-03-11 262/week @ 2024-04-01

295 downloads per month
Used in 2 crates

Apache-2.0

58KB
1K 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–9.5MB
~57K SLoC