pub struct XlogConfig {
pub log_dir: String,
pub name_prefix: String,
pub pub_key: Option<String>,
pub cache_dir: Option<String>,
pub cache_days: i32,
pub mode: AppenderMode,
pub compress_mode: CompressMode,
pub compress_level: i32,
}Expand description
Configuration used to create an Xlog instance or open the global appender.
Fields§
§log_dir: StringDirectory for log files. Must be non-empty.
name_prefix: StringPrefix for log file names and the instance name. Must be non-empty.
pub_key: Option<String>Optional public key (hex string, 128 chars) enabling log encryption.
cache_dir: Option<String>Optional cache directory for mmap buffers and temporary logs.
cache_days: i32Days to keep cached logs before moving them to log_dir.
mode: AppenderModeAppender mode (async or sync).
compress_mode: CompressModeCompression algorithm for log buffers/files.
compress_level: i32Compression level forwarded to the compressor.
Implementations§
Source§impl XlogConfig
impl XlogConfig
Sourcepub fn new(log_dir: impl Into<String>, name_prefix: impl Into<String>) -> Self
pub fn new(log_dir: impl Into<String>, name_prefix: impl Into<String>) -> Self
Create a config with required fields and sensible defaults.
Sourcepub fn cache_dir(self, dir: impl Into<String>) -> Self
pub fn cache_dir(self, dir: impl Into<String>) -> Self
Set the optional cache directory for mmap buffers and temp files.
Sourcepub fn cache_days(self, days: i32) -> Self
pub fn cache_days(self, days: i32) -> Self
Set the number of days to keep cached logs before moving them.
Sourcepub fn mode(self, mode: AppenderMode) -> Self
pub fn mode(self, mode: AppenderMode) -> Self
Set the appender mode.
Sourcepub fn compress_mode(self, mode: CompressMode) -> Self
pub fn compress_mode(self, mode: CompressMode) -> Self
Set the compression algorithm.
Sourcepub fn compress_level(self, level: i32) -> Self
pub fn compress_level(self, level: i32) -> Self
Set the compression level forwarded to the compressor.
Trait Implementations§
Source§impl Clone for XlogConfig
impl Clone for XlogConfig
Source§fn clone(&self) -> XlogConfig
fn clone(&self) -> XlogConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more