[−]Struct astral::thirdparty::slog::Record
One logging record
Corresponds to one logging statement like info!(...)
and carries all it's
data: eg. message, immediate key-value pairs and key-value pairs of Logger
used to execute it.
Record is passed to a Logger
, which delivers it to it's own Drain
,
where actual logging processing is implemented.
Methods
impl<'a> Record<'a>
pub fn new(
s: &'a RecordStatic<'a>,
msg: &'a Arguments<'a>,
kv: BorrowedKV<'a>
) -> Record<'a>
s: &'a RecordStatic<'a>,
msg: &'a Arguments<'a>,
kv: BorrowedKV<'a>
) -> Record<'a>
Create a new Record
Most of the time, it is slightly more performant to construct a Record
via the record!
macro because it enforces that the entire
RecordStatic
is built at compile-time.
Use this if runtime record creation is a requirement, as is the case with slog-async, for example.
pub fn msg(&self) -> &Arguments
Get a log record message
pub fn level(&self) -> Level
Get record logging level
pub fn line(&self) -> u32
Get line number
pub fn location(&self) -> &RecordLocation
Get line number
pub fn column(&self) -> u32
Get error column
pub fn file(&self) -> &'static str
Get file path
pub fn tag(&self) -> &str
Get tag
Tag is information that can be attached to Record
that is not meant
to be part of the norma key-value pairs, but only as an ad-hoc control
flag for quick lookup in the Drain
s. As such should be used carefully
and mostly in application code (as opposed to libraries) - where tag
meaning across the system can be coordinated. When used in libraries,
make sure to prefix is with something reasonably distinct, like create
name.
pub fn module(&self) -> &'static str
Get module
pub fn function(&self) -> &'static str
Get function (placeholder)
There's currently no way to obtain that information in Rust at compile time, so it is not implemented.
It will be implemented at first opportunity, and it will not be considered a breaking change.
pub fn kv(&self) -> BorrowedKV
Get key-value pairs
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,