log
#中文
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 to double the efficiency (as opposed to the standard library MPSC) with a lockless channel, using a channel to write logs asynchronously. Completely use the safe code to achieve, without safe code
-
Low overhead, based on thread
-
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
-----------------
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 >?
// Win10 (PC 6 core, mechanical hard disk)
- QPS: 1895767 QPS/s
// Win10 (PC 6 core, SSD)
- QPS: 1927177 QPS/s
support Future mode,async await based on mpsc channel, tokio or async_std support log split,zip_compress
- how to use?
= "0.4"
= { = "1.5"}
or enable zip/lz4/gzip Compression library
= "0.4"
# "lz4","zip","gzip"
= { = "1.5" , = ["lz4","zip","gzip"]}
Use Log(Console)
use ;
Use Log(File)
use ;
use ;
Split Log(.log packer)
use RollingType;
use LogSize;
use LogPacker;
Custom Log(impl do_log method)
use ;
use ;