Struct bdrck::logging::OptionsBuilder
source · [−]pub struct OptionsBuilder { /* private fields */ }
Expand description
OptionsBuilder provides a builder-style interface to construct an Options.
Implementations
sourceimpl OptionsBuilder
impl OptionsBuilder
sourcepub fn new() -> Self
pub fn new() -> Self
Construct a new OptionsBuilder, which by default just sets the options to their default values.
sourcepub fn set_filters(self, filters: LogFilters) -> Self
pub fn set_filters(self, filters: LogFilters) -> Self
Set the filters which will be applied to any logging calls before actually logging them.
sourcepub fn set_output_factory(self, output_factory: LogOutputFactory) -> Self
pub fn set_output_factory(self, output_factory: LogOutputFactory) -> Self
Set the output factory the Logger should use. This can be used to redirect logging output more generically, although for the common case set_output_to might be easier to use.
sourcepub fn set_output_to<T: Write + Send + 'static>(self, output_writer: T) -> Self
pub fn set_output_to<T: Write + Send + 'static>(self, output_writer: T) -> Self
Configure the Logger to write its log output to the given Write implementation (e.g. a File). This is a convenience function which just calls set_output_factory under the hood.
sourcepub fn set_panic_on_output_failure(self, panic_on_output_failure: bool) -> Self
pub fn set_panic_on_output_failure(self, panic_on_output_failure: bool) -> Self
Set whether or not the Logger should panic! if writing log output fails. Generally this can be useful for debugging, but in real production code losing a log entry might not be a good enough reason to terminate the entire process.
sourcepub fn set_always_flush(self, always_flush: bool) -> Self
pub fn set_always_flush(self, always_flush: bool) -> Self
Set whether or not the Logger should flush its output after every logging call. The benefit is that log messages show up immediately, and are less susceptible to “corruption” when logging from multiple threads, but the cost is a significant performance penalty for all logging calls.