#cbsk #logging #callback #sockets #tool #console #fast-log

cbsk_log

cbsk_log is a log tool

20 stable releases

Uses new Rust 2024

new 2.1.2 Mar 21, 2025
2.1.0 Dec 30, 2024
2.0.6 Nov 15, 2024
1.3.11 Aug 19, 2024
1.3.10 Jul 26, 2024

#6 in #cbsk

Download history 11/week @ 2024-11-22 4/week @ 2024-11-29 6/week @ 2024-12-06 1/week @ 2024-12-13 115/week @ 2024-12-27 14/week @ 2025-01-03 2/week @ 2025-01-10 3/week @ 2025-01-31 109/week @ 2025-02-07 48/week @ 2025-02-14 9/week @ 2025-02-21 45/week @ 2025-02-28

125 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.1.0"
cbsk_log_tokio = "2.1.0"

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.1.0"
cbsk_log_tokio = "2.1.0"

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
~75K SLoC