Struct lunatic_log::Metadata

source ·
pub struct Metadata { /* private fields */ }
Expand description

Metadata describing an Event.

All events have the following metadata:

  • A [name], represented as a static string.
  • A [target], a string that categorizes part of the system where the event or event occurred. The macros default to using the module path where the event or event originated as the target, but it may be overridden.
  • A [verbosity level]. This determines how verbose a given event is, and allows enabling or disabling more verbose diagnostics situationally. See the documentation for the Level type for details.
  • The names of the [fields] defined by the event.
  • Whether the metadata corresponds to a event.

In addition, the following optional metadata describing the source code location where the event originated may be provided:

  • The [file name]
  • The [line number]
  • The [module path]

Implementations§

source§

impl Metadata

source

pub const fn new( name: String, target: String, level: Level, module_path: Option<String>, file: Option<String>, line: Option<u32> ) -> Self

Construct new metadata for a event, with a name, target, level, field names, and optional source code location.

source

pub fn level(&self) -> &Level

Returns the level of verbosity of the described span or event.

source

pub fn name(&self) -> &String

Returns the name of the span.

source

pub fn target(&self) -> &String

Returns a string describing the part of the system where the span or event that this metadata describes occurred.

Typically, this is the module path, but alternate targets may be set when spans or events are constructed.

source

pub fn module_path(&self) -> Option<&String>

Returns the path to the Rust module where the span occurred, or None if the module path is unknown.

source

pub fn file(&self) -> Option<&String>

Returns the name of the source code file where the span occurred, or None if the file is unknown

source

pub fn line(&self) -> Option<u32>

Returns the line number in the source code file where the span occurred, or None if the line number is unknown.

Trait Implementations§

source§

impl Clone for Metadata

source§

fn clone(&self) -> Metadata

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Metadata

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Metadata

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for Metadata

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,