#log #cbsk #tool #filter #packer #module #zip

cbsk_log

cbsk_log is a log tool

9 stable releases

1.3.7 Jun 11, 2024
1.3.4 Jun 6, 2024
1.3.2 May 26, 2024

#999 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

934 downloads per month

MIT/Apache

82KB
1.5K SLoC

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

file split example

Cargo.toml:

cbsk_base = "1.3.4"
cbsk_log = "1.3.7"

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.4"
cbsk_log = "1.3.7"

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–12MB
~139K SLoC