pub struct Builder { /* private fields */ }Expand description
A builder for configuring the file logger.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn directory(self, dir: impl Into<PathBuf>) -> Self
pub fn directory(self, dir: impl Into<PathBuf>) -> Self
Set the directory where the log file will be stored.
Defaults to the Alfred workflow cache directory.
Sourcepub fn filename(self, filename: impl Into<Cow<'static, str>>) -> Self
pub fn filename(self, filename: impl Into<Cow<'static, str>>) -> Self
Set the name of the log file relative to the directory.
Defaults to powerpack.log.
Sourcepub fn max_level(self, max_level: LevelFilter) -> Self
pub fn max_level(self, max_level: LevelFilter) -> Self
Set the maximum log level
Sourcepub fn init(self)
pub fn init(self)
Initialize the logger
§Panics
Panics if the logger has already been initialized or there are IO errors when creating/accessing the log file.
Use Builder::try_init if you want to handle the error.
Sourcepub fn init_idempotent(self)
pub fn init_idempotent(self)
Initialize the logger if it hasn’t already been initialized.
§Panics
Panics if there are IO errors when creating/accessing the log file.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
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