pub struct LogConfig {
pub level: String,
pub format: LogFormat,
pub log_dir: String,
pub file_prefix: String,
pub rotation: RotationPolicy,
pub max_size: String,
pub max_backups: usize,
pub compress: bool,
pub module_levels: HashMap<String, String>,
pub also_stdout: bool,
}Expand description
Complete logging configuration
Fields§
§level: StringLog level (trace, debug, info, warn, error)
format: LogFormatLog format (text or json)
log_dir: StringDirectory for log files
file_prefix: StringBase name for log files
rotation: RotationPolicyRotation policy
max_size: StringMaximum file size for size-based rotation (e.g., “100MB”)
max_backups: usizeMaximum number of archived log files to keep
compress: boolWhether to compress archived logs
module_levels: HashMap<String, String>Per-module log level overrides
also_stdout: boolWhether to log to stdout in addition to files
Implementations§
Source§impl LogConfig
impl LogConfig
Sourcepub fn parse_level(&self) -> Result<Level>
pub fn parse_level(&self) -> Result<Level>
Parse log level string to tracing Level
Sourcepub fn max_size_bytes(&self) -> Result<usize>
pub fn max_size_bytes(&self) -> Result<usize>
Parse max size to bytes
Sourcepub fn build_filter(&self) -> Result<EnvFilter>
pub fn build_filter(&self) -> Result<EnvFilter>
Build an EnvFilter from the configuration
Trait Implementations§
Source§impl<'de> Deserialize<'de> for LogConfig
impl<'de> Deserialize<'de> for LogConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for LogConfig
impl RefUnwindSafe for LogConfig
impl Send for LogConfig
impl Sync for LogConfig
impl Unpin for LogConfig
impl UnsafeUnpin for LogConfig
impl UnwindSafe for LogConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more