Struct cli_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
impl<'a> Record<'a>
[src]
impl<'a> Record<'a>
[src]pub fn builder() -> RecordBuilder<'a>
[src]
pub fn builder() -> RecordBuilder<'a>
[src]Returns a new builder.
pub fn module_path(&self) -> Option<&'a str>
[src]
pub fn module_path(&self) -> Option<&'a str>
[src]The module path of the message.
pub fn module_path_static(&self) -> Option<&'static str>
[src]
pub fn module_path_static(&self) -> Option<&'static str>
[src]The module path of the message, if it is a 'static
string.
pub fn file_static(&self) -> Option<&'static str>
[src]
pub fn file_static(&self) -> Option<&'static str>
[src]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> !Send for Record<'a>
impl<'a> !Sync for Record<'a>
impl<'a> Unpin for Record<'a>
impl<'a> !UnwindSafe for Record<'a>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more