#log #cbsk #tool #file #split #console

cbsk_log

cbsk_log is a log tool

12 stable releases

new 1.3.10 Jul 26, 2024
1.3.9 Jul 19, 2024
1.3.8 Jun 27, 2024
1.3.2 May 26, 2024

#800 in Data structures

Download history 239/week @ 2024-05-13 392/week @ 2024-05-20 37/week @ 2024-05-27 165/week @ 2024-06-03 333/week @ 2024-06-10 3/week @ 2024-06-17 134/week @ 2024-06-24 4/week @ 2024-07-01 104/week @ 2024-07-15

242 downloads per month

MIT/Apache

93KB
1.5K 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 = "1.3.10"
cbsk_log = "1.3.10"

main.rs:

use cbsk_base::log;
use cbsk_log::config::Config;
use cbsk_log::filter::module_filter::ModuleFilter;
use cbsk_log::model::log_size::LogSize;
use cbsk_log::packer::zip_packer::ZipPacker;

pub fn main() {
    let conf = Config::default()
        .push_filter(ModuleFilter::default().push("test"))
        .file_split("/logs/", LogSize::MB(5), ZipPacker::default().pack_end(|pack_name| {
            println!("pack name is {pack_name}");
        }));

    cbsk_log::init(conf).unwrap();
    log::info!("hello world");

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

console example

Cargo.toml:

cbsk_base = "1.3.10"
cbsk_log = "1.3.10"

main.rs:

use cbsk_base::log;
use cbsk_log::config::Config;
use cbsk_log::filter::module_filter::ModuleFilter;

pub fn main() {
    let conf = Config::default()
        .push_filter(ModuleFilter::default().push("test"))
        .console();

    cbsk_log::init(conf).unwrap();
    log::info!("hello world");

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

Dependencies

~4–13MB
~138K SLoC