[−][src]Struct flexi_logger::ReconfigurationHandle
Allows reconfiguring the logger programmatically.
Example
Obtain the ReconfigurationHandle
(using .start()
):
let mut log_handle = Logger::with_str("info") // ... your logger configuration goes here, as usual .start() .unwrap_or_else(|e| panic!("Logger initialization failed with {}", e)); // ...
You can permanently exchange the log specification programmatically, anywhere in your code:
// ... log_handle.parse_new_spec("warn"); // ...
However, when debugging, you often want to modify the log spec only temporarily, for
one or few method calls only; this is easier done with the following method, because
it allows switching back to the previous spec:
log_handle.parse_and_push_temp_spec("trace"); // ... // critical calls // ... log_handle.pop_temp_spec(); // Continue with the log spec you had before. // ...
Methods
impl ReconfigurationHandle
[src]
pub fn set_new_spec(&mut self, new_spec: LogSpecification)
[src]
Allows specifying a new LogSpecification for the current logger.
pub fn parse_new_spec(&mut self, spec: &str)
[src]
Allows specifying a new LogSpecification for the current logger.
pub fn push_temp_spec(&mut self, new_spec: LogSpecification)
[src]
Allows temporarily pushing a new LogSpecification for the current logger.
pub fn parse_and_push_temp_spec(&mut self, new_spec: &str)
[src]
Allows temporarily pushing a new LogSpecification for the current logger.
pub fn pop_temp_spec(&mut self)
[src]
Allows pushing a new LogSpecification for the current logger. It will automatically be popped once the returned guard is dropped.
Auto Trait Implementations
impl Send for ReconfigurationHandle
impl Sync for ReconfigurationHandle
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,