16 stable releases

2.0.2 Sep 4, 2024
2.0.1 Aug 26, 2024
1.3.11 Aug 19, 2024
1.3.10 Jul 26, 2024
1.3.2 May 26, 2024

#934 in Data structures

Download history 4/week @ 2024-07-01 104/week @ 2024-07-15 127/week @ 2024-07-22 29/week @ 2024-07-29 309/week @ 2024-08-19 163/week @ 2024-08-26 160/week @ 2024-09-02 4/week @ 2024-09-09 9/week @ 2024-09-16 60/week @ 2024-09-23 4/week @ 2024-09-30 5/week @ 2024-10-07 11/week @ 2024-10-14

80 downloads per month
Used in 2 crates

MIT/Apache

32KB
546 lines

cbsk_log is a log tool, the inspiration for this log writing library comes from fast_log

support the minimum version of Rust

1.80.0

file split example

Cargo.toml:

cbsk_base = "2.0.2"
cbsk_log_tokio = "2.0.2"

main.rs:

use cbsk_base::{log, tokio};
use cbsk_log_tokio::cbsk_log::config::Config;
use cbsk_log_tokio::cbsk_log::model::log_size::LogSize;
use cbsk_log_tokio::config::FileSplitTrait;
use cbsk_log_tokio::packer::zip_packer::ZipPacker;

#[tokio::main]
async fn main() {
    let config = Config::default().file_split("E:\\logs\\", LogSize::KB(5), ZipPacker::pack_end(|zip_path| {
        Box::pin(async move {
            println!("{zip_path}");
        })
    }));
    cbsk_log_tokio::init(config).unwrap();
    for i in 1..10000 {
        log::info!("hello world, {i}");
    }

    log::logger().flush();
}

console example

Cargo.toml:

cbsk_base = "2.0.2"
cbsk_log_tokio = "2.0.2"

main.rs:

use cbsk_base::{log, tokio};
use cbsk_log_tokio::cbsk_log::config::Config;

#[tokio::main]
async fn main() {
    cbsk_log_tokio::init(Config::default().console()).unwrap();
    for i in 1..10000 {
        log::info!("hello world, {i}");
    }

    log::logger().flush();
}

Dependencies

~1.3–8.5MB
~71K SLoC