[−][src]Struct log::Record
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) {} }
Methods
impl<'a> Record<'a>
[src]
impl<'a> Record<'a>
pub fn builder() -> RecordBuilder<'a>
[src]
pub fn builder() -> RecordBuilder<'a>
Returns a new builder.
pub fn args(&self) -> &Arguments<'a>
[src]
pub fn args(&self) -> &Arguments<'a>
The message body.
pub fn metadata(&self) -> &Metadata<'a>
[src]
pub fn metadata(&self) -> &Metadata<'a>
Metadata about the log directive.
pub fn level(&self) -> Level
[src]
pub fn level(&self) -> Level
The verbosity level of the message.
pub fn target(&self) -> &'a str
[src]
pub fn target(&self) -> &'a str
The name of the target of the directive.
pub fn module_path(&self) -> Option<&'a str>
[src]
pub fn module_path(&self) -> Option<&'a str>
The module path of the message.
pub fn file(&self) -> Option<&'a str>
[src]
pub fn file(&self) -> Option<&'a str>
The source file containing the message.
pub fn line(&self) -> Option<u32>
[src]
pub fn line(&self) -> Option<u32>
The line containing the message.
Trait Implementations
impl<'a> Debug for Record<'a>
[src]
impl<'a> Debug for Record<'a>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<'a> Clone for Record<'a>
[src]
impl<'a> Clone for Record<'a>
Auto Trait Implementations
Blanket Implementations
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more