Struct log::Record [−][src]
pub struct Record<'a> { /* fields omitted */ }
Expand description
The “payload” of a log message.
Use
Record
structures are passed as parameters to the log
method of the Log
trait. Logger implementors manipulate these
structures in order to display log messages. Record
s are automatically
created by the log!
macro and so are not seen by log users.
Note that the level()
and target()
accessors are equivalent to
self.metadata().level()
and self.metadata().target()
respectively.
These methods are provided as a convenience for users of this structure.
Example
The following example shows a simple logger that displays the level,
module path, and message of any Record
that is passed to it.
struct SimpleLogger;
impl log::Log for SimpleLogger {
fn enabled(&self, metadata: &log::Metadata) -> bool {
true
}
fn log(&self, record: &log::Record) {
if !self.enabled(record.metadata()) {
return;
}
println!("{}:{} -- {}",
record.level(),
record.target(),
record.args());
}
fn flush(&self) {}
}
Implementations
Returns a new builder.
The module path of the message.
The module path of the message, if it is a 'static
string.
The module path of the message, if it is a 'static
string.
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Record<'a>
impl<'a> !UnwindSafe for Record<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more