All Projects → co-rs → fast_log

co-rs / fast_log

Licence: Apache-2.0 license
Rust async log High-performance asynchronous logging

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to fast log

RFKit
Toolkit for daily Cocoa development. Since 2012.
Stars: ✭ 20 (-80.77%)
Mutual labels:  log
bk-log
蓝鲸日志平台是为了解决运维场景中查询日志难的问题而推出的一款SaaS,基于业界主流的全文检索引擎,通过蓝鲸智云的专属agent进行日志采集,无需登录各台机器,集中管理所有日志。
Stars: ✭ 102 (-1.92%)
Mutual labels:  log
vim-log-highlighting
Syntax highlighting for generic log files in VIM
Stars: ✭ 164 (+57.69%)
Mutual labels:  log
Klog
🎼 A Kotlin log lib, making the output log more elegant and more beautiful.
Stars: ✭ 21 (-79.81%)
Mutual labels:  log
BuildTimeLogger-for-Xcode
A console app for logging Xcode build times and presenting them in a notification
Stars: ✭ 43 (-58.65%)
Mutual labels:  log
ULog
Unified cross-platform logging framework for C, C++, Objective-C, Swift, ASL and C#.
Stars: ✭ 13 (-87.5%)
Mutual labels:  log
PCPXlog
通过简单配置将日志同时输出到console、file、MongoDB | 可以pip安装
Stars: ✭ 13 (-87.5%)
Mutual labels:  log
slack-backup
Make copy of slack converstaions
Stars: ✭ 15 (-85.58%)
Mutual labels:  log
log-target-file
Yii Logging Library - File Target
Stars: ✭ 19 (-81.73%)
Mutual labels:  log
CocoaLogKit
Log framework based on CocoaLumberjack and ZipArchive
Stars: ✭ 17 (-83.65%)
Mutual labels:  log
logtail
logtail is a log tailing utility, support tailing multiple commands output stream, transferring matching content to file/webhook(like dingtalk)
Stars: ✭ 33 (-68.27%)
Mutual labels:  log
kuafu
This is a tool library that includes log, fsm, state machine...
Stars: ✭ 83 (-20.19%)
Mutual labels:  log
haminer
[mirror] Library and program to parse and forward HAProxy HTTP logs
Stars: ✭ 22 (-78.85%)
Mutual labels:  log
fakessh
A dockerized fake SSH server honeypot written in Go that logs login attempts.
Stars: ✭ 42 (-59.62%)
Mutual labels:  log
logging
mod: zap logging in golang
Stars: ✭ 44 (-57.69%)
Mutual labels:  log
loggie
A lightweight, cloud-native data transfer agent and aggregator
Stars: ✭ 844 (+711.54%)
Mutual labels:  log
sprout
Golang logging library supporting log retrieval.
Stars: ✭ 85 (-18.27%)
Mutual labels:  log
log
A simple to use log system, minimalist but with features for debugging and differentiation of messages
Stars: ✭ 21 (-79.81%)
Mutual labels:  log
XLog
一个简易的日志打印框架(支持打印策略自定义,默认提供2种策略:logcat打印和磁盘打印)
Stars: ✭ 33 (-68.27%)
Mutual labels:  log
clue
a extremely high performance log library for android. 高性能的Android日志库
Stars: ✭ 27 (-74.04%)
Mutual labels:  log

fast_log

Build Status GitHub release

the fast log . This crate uses #! [forbid(unsafe_code)] to ensure everything is implemented in 100% Safe Rust.

A log implementation for extreme speed, using Crossbeam/channel ,once Batch write logs,fast log date, Appender architecture, appender per thread

  • Low overhead, log write based on thread, also support tokio/Future

  • High performance, use lockless message queue, log is stored in queue, then flush disk. It does not block the caller

  • Full APPEND mode file writing, high efficiency for solid state/mechanical disk (solid state and mechanical disk sequential write performance is better than random write)

  • When channel pressure increases, logs can be written in batches at a time

  • Built-in ZIP compression, compressed file name date + serial number, no need to worry about the log file is too large

  • Built-in log segmentation, custom log full number of immediately split

  • Built-in filtering configuration support, can be customized to filter out other library printed logs

  • Support custom compression algorithms, such as ZIP and LZ4

  • Support use log::logger().flush() method wait to flush disk

  • Simple and efficient Appender architecture.Both configuration and customization are simple


              -----------------
log data->    | main channel(crossbeam)  |   ->          
              ----------------- 
                                        ----------------                                    ----------------------
                                  ->    |thread channel)|  -> background thread  |    appender1  |
                                        ----------------                                    ----------------------

                                        ----------------                                    ----------------------
                                  ->    |thread channel)|  -> background thread  |    appender2  |
                                        ----------------                                    ----------------------

                                        ----------------                                    ----------------------
                                  ->    |thread channel)|  -> background thread  |    appender3  |
                                        ----------------                                    ----------------------

                                        ----------------                                    ----------------------
                                  ->    |thread channel)|  -> background thread  |    appender4  |
                                        ----------------                                    ----------------------


  • How fast is?

  • no flush(chan_len=1000000) benches/log.rs

//MACOS(Apple M1MAX-32GB)
test bench_log ... bench:          85 ns/iter (+/- 1,800)
  • all log flush into file(chan_len=1000000) example/bench_test_file.rs
//MACOS(Apple M1MAX-32GB)
test bench_log ... bench:          323 ns/iter (+/- 0)
  • how to use?
log = "0.4"
fast_log = {version = "1.5"}

or enable zip/lz4/gzip Compression library

log = "0.4"
# "lz4","zip","gzip"
fast_log = {version = "1.5" , features = ["lz4","zip","gzip"]}

Performance optimization(important)

  • use chan_len(Some(100000)) Preallocating channel memory reduces the overhead of memory allocation,for example:
use log::{error, info, warn};
fn  main(){
    fast_log::init(Config::new().file("target/test.log").chan_len(Some(100000))).unwrap();
    log::info!("Commencing yak shaving{}", 0);
}

Use Log(Console)

use log::{error, info, warn};
fn  main(){
    fast_log::init(Config::new().console().chan_len(Some(100000))).unwrap();
    log::info!("Commencing yak shaving{}", 0);
}

Use Log(Console Print)

use log::{error, info, warn};
fn  main(){
    fast_log::init(Config::new().console().chan_len(Some(100000))).unwrap();
    fast_log::print("Commencing print\n".into());
}

Use Log(File)

use fast_log::{init_log};
use log::{error, info, warn};
fn  main(){
    fast_log::init(Config::new().file("target/test.log").chan_len(Some(100000))).unwrap();
    log::info!("Commencing yak shaving{}", 0);
    info!("Commencing yak shaving");
}

Split Log(.log packer)

use fast_log::plugin::file_split::RollingType;
use fast_log::consts::LogSize;
use fast_log::plugin::packer::LogPacker;

#[test]
pub fn test_file_compation() {
    fast_log::init(Config::new()
        .console()
        .chan_len(Some(100000))
        .file_split("target/logs/",
                    LogSize::MB(1),
                    RollingType::All,
                    LogPacker{})).unwrap();
    for _ in 0..200000 {
        info!("Commencing yak shaving");
    }
    log::logger().flush();
}
Custom Log(impl do_log method)
use fast_log::{LogAppender};
use log::{error, info, warn};

pub struct CustomLog{}
impl LogAppender for CustomLog{
    fn do_log(&mut self, record: &FastLogRecord) {
        print!("{}",record);
    }
}
fn  main(){
    let wait = fast_log::init(Config::new().custom(CustomLog {}).chan_len(Some(100000))).unwrap();
    info!("Commencing yak shaving");
    log::logger().flush();
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].