[−][src]Struct loggify::LogBuilder
Struct for building a new logger
Implementations
impl LogBuilder
[src]
pub fn new() -> Self
[src]
Creates a new instance of the LogBuilder
Defaults
level
-> The default level isInfo
exclude
-> No targets are excludedtime_format
-> dd.mm.YY HH:MM:SSlog_target
-> false
Example
//! Example for initializing the logger with the LogBuilder use log::{error, warn, info, debug, trace}; use loggify::LogBuilder; /// The `LogBuilder` is used to set more logger options /// This example will change the log level to Trace /// and the printed time format to time only fn main() { LogBuilder::new() .set_level(log::Level::Trace) .set_time_format(String::from("%H:%M:%S")) .build() .unwrap(); error!("My error message"); warn!("My warn message"); info!("My info message"); debug!("My debug message"); trace!("My trace message"); }
pub fn add_exclude(self, name: String) -> Self
[src]
Adds a new target to exclude from logging
See the example exclude
for usage
pub fn set_level(self, level: Level) -> Self
[src]
Sets the minimum level
pub fn set_time_format(self, format: String) -> Self
[src]
Sets the time format See https://docs.rs/chrono/0.4.6/chrono/format/strftime/index.html for supported escape sequences
pub fn set_log_target(self, state: bool) -> Self
[src]
Defines if the log target should be printed or not This option should be used to find out where a log comes from and what target to exclude from logging
pub fn disable_color(self) -> Self
[src]
Disables color output
Per default true
pub fn build(self) -> Result<(), SetLoggerError>
[src]
Creates a new logger
Trait Implementations
impl Default for LogBuilder
[src]
Auto Trait Implementations
impl RefUnwindSafe for LogBuilder
impl Send for LogBuilder
impl Sync for LogBuilder
impl Unpin for LogBuilder
impl UnwindSafe for LogBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,