pub struct ParallelLogger { /* private fields */ }Expand description
A log::Log implementation that executes all logging in parallel.
Simply pass the actual loggers in the call to ParallelLogger::init.
Implementations§
Source§impl ParallelLogger
impl ParallelLogger
Sourcepub fn init(
log_level: LevelFilter,
mode: ParallelMode,
actual_loggers: Vec<Box<dyn Log>>,
) -> ShutdownHandle
pub fn init( log_level: LevelFilter, mode: ParallelMode, actual_loggers: Vec<Box<dyn Log>>, ) -> ShutdownHandle
Initializes the ParallelLogger.
This function sets up a new ParallelLogger with the specified log level, the parallel execution mode and the actual loggers.
Depending on the ParallelMode setting, either one or more threads will be created to process the actual loggers.
The ParallelLogger is then set as the global logger for the log crate.
§Arguments
log_level- The maximum log level that the logger will handle. Log messages with a level higher than this will be ignored. This will also apply to the actual loggers even though those might have a higher log level set in their configs.mode- The parallel execution mode that theParallelLoggerwill use.actual_loggers- The actual loggers that theParallelLoggerwill forward log messages to.
§Returns
A ShutdownHandle that can be used to shut down the ParallelLogger and possibly flush the remaining messages in the queue.
§Panics
- if another logger was already set for the
logcrate - if no actual logger was provided
- if a thread could not be created
Trait Implementations§
Source§impl Debug for ParallelLogger
impl Debug for ParallelLogger
Source§impl Log for ParallelLogger
impl Log for ParallelLogger
Auto Trait Implementations§
impl Freeze for ParallelLogger
impl RefUnwindSafe for ParallelLogger
impl Send for ParallelLogger
impl Sync for ParallelLogger
impl Unpin for ParallelLogger
impl UnwindSafe for ParallelLogger
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