Struct spdlog::LogCrateProxy

source ·
pub struct LogCrateProxy { /* private fields */ }
Available on crate feature log only.
Expand description

Log crate proxy.

It forwards all log messages from log crate to default_logger by default, and you can set a separate logger for it via LogCrateProxy::set_logger.

If upstream dependencies use log crate to output log messages, they may also be received by LogCrateProxy.

Note that the log crate uses a different log level filter and by default it rejects all log messages. To make LogCrateProxy able to receive log messages from log crate, you may need to call log_crate::set_max_level with log_crate::LevelFilter.

Examples

use spdlog::log_crate as log;

spdlog::init_log_crate_proxy()?;
// Enable all log messages from `log` crate.
log::set_max_level(log::LevelFilter::Trace);

For more and detailed examples, see ./examples directory.

Implementations§

Swaps a logger.

If the argument logger is None, the return value of default_logger will be used.

Sets a logger.

If the argument logger is None, the return value of default_logger will be used.

Trait Implementations§

Returns the “default value” for a type. Read more
Determines if a log message with the specified metadata would be logged. Read more
Logs the Record. Read more
Flushes any buffered records.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.