pub struct FileLogger { /* private fields */ }Expand description
The FileLogger struct. Provides a Logger implementation for structs implementing Write, e.g. File
Implementations§
Source§impl FileLogger
impl FileLogger
Sourcepub fn init(
log_level: LevelFilter,
config: Config,
file_path: &str,
max_size: Option<u64>,
) -> Result<(), SetLoggerError>
pub fn init( log_level: LevelFilter, config: Config, file_path: &str, max_size: Option<u64>, ) -> Result<(), SetLoggerError>
init function. Globally initializes the FileLogger as the one and only used log facility.
Takes the desired Level, Config and file_path and max_size struct as arguments. They cannot be changed later on.
Fails if another Logger was already initialized.
§Examples
let _ = FileLogger::init(LevelFilter::Info, Config::default(), "my_rust_bin.log", Some(1024 * 1024 * 10));Sourcepub fn new(
log_level: LevelFilter,
config: Config,
file_path: &str,
max_size: Option<u64>,
) -> Box<Self>
pub fn new( log_level: LevelFilter, config: Config, file_path: &str, max_size: Option<u64>, ) -> Box<Self>
allows to create a new logger, that can be independently used, no matter what is globally set.
no macros are provided for this case and you probably
dont want to use this function, but init(), if you dont want to build a CombinedLogger.
Takes the desired Level, Config and Write struct as arguments. They cannot be changed later on.
§Examples
let file_logger = FileLogger::new(LevelFilter::Info, Config::default(), "my_rust_bin.log", Some(1024 * 1024 * 10));Creates a new instance of FileLogger.
Trait Implementations§
Source§impl Log for FileLogger
impl Log for FileLogger
Auto Trait Implementations§
impl !Freeze for FileLogger
impl RefUnwindSafe for FileLogger
impl Send for FileLogger
impl Sync for FileLogger
impl Unpin for FileLogger
impl UnwindSafe for FileLogger
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