Crate ezlog

Source
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§

EZLogConfig
A config to set up EZLogger
EZLogConfigBuilder
The builder of EZLogConfig
EZLogger
EZRecord
Single Log record
EZRecordBuilder
EZRecord’s builder
EventPrinter
Default EventListener implementation, print every event in console
FetchReq
Fetch Logs file‘s path reqeust
FetchResult
Fetch Logs file‘s path result.
Header
EZLog file Header
InitBuilder
InitBuilder is used to init ezlog

Enums§

CipherKind
Cipher kind current support
CompressKind
Compress type can be used to compress the log file.
CompressLevel
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
EZLogCallback
Async callback for fetch log files
Encryptor
Encrypt function abstract
EventListener
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
initDeprecated
Init ezlog
init_with_eventDeprecated
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