#logging #cbsk #tokio #run-time #log-file #tool #sockets

cbsk_log_tokio

cbsk_log_tokio is a log tool, using tokio as the runtime

4 stable releases

2.1.0 Dec 30, 2024
2.0.6 Nov 15, 2024
2.0.2 Sep 4, 2024
2.0.1 Aug 26, 2024

#1417 in Data structures

Download history 6/week @ 2024-09-21 1/week @ 2024-09-28 1/week @ 2024-10-05 6/week @ 2024-10-12 12/week @ 2024-11-02 88/week @ 2024-11-09 42/week @ 2024-11-16 3/week @ 2024-11-23 3/week @ 2024-12-07 112/week @ 2024-12-28 12/week @ 2025-01-04

124 downloads per month

MIT/Apache

59KB
1K SLoC

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

~3–12MB
~139K SLoC