Expand description
ezlog is a high efficiency cross-platform logging library.
It is inspired by Xlog and Loagan, rewrite in Rust.
Guide level documentation is found on the website.
§Features
- multi platform: Flutter, Android, iOS, Windows, Linux, MacOS
- map file into memory by mmap.
- compression support, eg: zlib.
- encryption support, eg: AEAD encryption.
- fetch log by callback.
- trim out of date files.
- command line parser support.
§example
use ezlog::EZLogConfigBuilder;
use ezlog::Level;
use log::trace;
ezlog::InitBuilder::new().debug(true).init();
let config: ezlog::EZLogConfig = EZLogConfigBuilder::new()
.level(Level::Trace)
.dir_path(
dirs::cache_dir()
.unwrap()
.into_os_string()
.into_string()
.expect("dir path error"),
)
.build();
ezlog::create_log(config);
trace!("hello ezlog");
Structs§
- EZLog
Config - A config to set up EZLogger
- EZLog
Config Builder - The builder of EZLogConfig
- EZLogger
- EZRecord
- Single Log record
- EZRecord
Builder - EZRecord’s builder
- Event
Printer - Default EventListener implementation, print every event in console
- Fetch
Req - Fetch Logs file‘s path reqeust
- Fetch
Result - Fetch Logs file‘s path result.
- Header
- EZLog file Header
- Init
Builder - InitBuilder is used to init ezlog
Enums§
- Cipher
Kind - Cipher kind current support
- Compress
Kind - Compress type can be used to compress the log file.
- Compress
Level - Compress level
- EZMsg
- Event
- EZLog Event Listener
- Level
- Log level, used to filter log records
- LogError
- Version
- Log version enum
Constants§
- DEFAULT_
LOG_ NAME - A EZLogger default name. current is “default”.
- V1_
LOG_ HEADER_ SIZE - Log file fixed header length.
- V2_
LOG_ HEADER_ SIZE
Traits§
- Compress
- The Compression trait + Decompression trait
- Compression
- The Logger struct to implement the Log encode. Compress function abstract
- Cryptor
- The Encryptor trait + Decryptor trait
- Decompression
- Decompress function abstract
- Decryptor
- decrypt function abstract
- EZLog
Callback - Async callback for fetch log files
- Encryptor
- Encrypt function abstract
- Event
Listener - Formatter
- MsgHandler
Functions§
- create_
compress - create_
cryptor - create_
log - Create a new EZLogger from an EZLogConfig
- flush
- Force flush the log file
- flush_
all - Flush all log files
- format
- init
Deprecated - Init ezlog
- init_
with_ event Deprecated - log
- Write a EZRecord to the log file
- request_
log_ files_ for_ date - Request logs file path array at the date which EZLogger’s name is define in the parameter
- set_
boxed_ callback - Set the boxed EZLogCallback
- set_
boxed_ formatter - set_
event_ listener - Set global EventListener
- trim
- Trim all EZLoggers outdated files