Struct Metadata
pub struct Metadata<'a> { /* private fields */ }
Metadata about a log message.
Use
Metadata structs are created when users of the library use
logging macros.
They are consumed by implementations of the Log trait in the
enabled method.
Records use Metadata to determine the log message's severity
and target.
Users should use the log_enabled! macro in their code to avoid
constructing expensive log messages.
Examples
use log::{Record, Level, Metadata};
struct MyLogger;
impl log::Log for MyLogger {
fn enabled(&self, metadata: &Metadata) -> bool {
metadata.level() <= Level::Info
}
fn log(&self, record: &Record) {
if self.enabled(record.metadata()) {
println!("{} - {}", record.level(), record.args());
}
}
fn flush(&self) {}
}
# fn main(){}
Implementations
impl<'a> Metadata<'a>
fn builder() -> MetadataBuilder<'a>Returns a new builder.
fn level(&self) -> LevelThe verbosity level of the message.
fn target(&self) -> &'a strThe name of the target of the directive.
Trait Implementations
impl<'a> Clone for Metadata<'a>
fn clone(&self) -> Self
impl<'a> Debug for Metadata<'a>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<'a> Eq for Metadata<'a>
impl<'a> Hash for Metadata<'a>
fn hash<__H: Hasher>(&self, state: &mut __H)
impl<'a> Ord for Metadata<'a>
fn cmp(&self, other: &Self) -> Ordering
impl<'a> PartialEq for Metadata<'a>
fn eq(&self, other: &Self) -> bool
impl<'a> PartialOrd for Metadata<'a>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>