pub struct Builder {
pub dynamic: bool,
pub rotation_signals: Vec<i32>,
pub panic: bool,
pub continue_when_panic: bool,
/* private fields */
}Expand description
Global config to setup logger See crate::recipe for usage
Fields§
§dynamic: boolWhen dynamic==true, Can safely re-initialize GlobalLogger even it exists, useful to setup different types of logger in test suits. When dynamic==false, Only initialize once, logger sinks setting cannot be change afterwards. More efficient for production environment.
rotation_signals: Vec<i32>Listen for signal of log-rotate NOTE: Once logger started to listen signal, does not support dynamic reconfigure.
panic: boolHookup to log error when panic
continue_when_panic: boolWhether to exit program after panic
Implementations§
Source§impl Builder
impl Builder
pub fn new() -> Self
Sourcepub fn test(self) -> Self
pub fn test(self) -> Self
For test cases, set dynamic=true and turn Off signal. Call this with pre-set recipe for convenient.
Sourcepub fn raw_file(self, config: LogRawFile) -> Self
pub fn raw_file(self, config: LogRawFile) -> Self
Add raw file sink that supports multiprocess atomic append
Sourcepub fn buf_file(self, config: LogBufFile) -> Self
pub fn buf_file(self, config: LogBufFile) -> Self
Add buffered file sink which merged I/O and delay flush
Sourcepub fn console(self, config: LogConsole) -> Self
pub fn console(self, config: LogConsole) -> Self
Add console sink
Sourcepub fn get_max_level(&self) -> LevelFilter
pub fn get_max_level(&self) -> LevelFilter
Return the max log level in the log sinks