Struct Event
pub struct Event<'a> { /* private fields */ }
Events represent single points in time where something occurred during the
execution of a program.
An Event can be compared to a log record in unstructured logging, but with
two key differences:
Events exist within the context of a span. Unlike log lines, they may be located within the trace tree, allowing visibility into the temporal context in which the event occurred, as well as the source code location.- Like spans,
Events have structured key-value data known as fields, which may include textual message. In general, a majority of the data associated with an event should be in the event's fields rather than in the textual message, as the fields are more structured.
Implementations
impl<'a> Event<'a>
fn dispatch(metadata: &'static Metadata<'static>, fields: &'a ValueSet<'_>)Constructs a new
Eventwith the specified metadata and set of values, and observes it with the current subscriber.fn new(metadata: &'static Metadata<'static>, fields: &'a ValueSet<'a>) -> SelfReturns a new
Eventin the current span, with the specified metadata and set of values.fn new_child_of(parent: impl Into<Option<Id>>, metadata: &'static Metadata<'static>, fields: &'a ValueSet<'a>) -> SelfReturns a new
Eventas a child of the specified span, with the provided metadata and set of values.fn child_of(parent: impl Into<Option<Id>>, metadata: &'static Metadata<'static>, fields: &'a ValueSet<'_>)Constructs a new
Eventwith the specified metadata and set of values, and observes it with the current subscriber and an explicit parent.fn record(&self, visitor: &mut dyn Visit)Visits all the fields on this
Eventwith the specified visitor.fn fields(&self) -> IterReturns an iterator over the set of values on this
Event.fn metadata(&self) -> &'static Metadata<'static>Returns metadata describing this
Event.fn is_root(&self) -> boolReturns true if the new event should be a root.
fn is_contextual(&self) -> boolReturns true if the new event's parent should be determined based on the current context.
If this is true and the current thread is currently inside a span, then that span should be the new event's parent. Otherwise, if the current thread is not inside a span, then the new event will be the root of its own trace tree.
fn parent(&self) -> Option<&Id>Returns the new event's explicitly-specified parent, if there is one.
Otherwise (if the new event is a root or is a child of the current span), returns
None.
Trait Implementations
impl<'a> Debug for Event<'a>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Event<'a>
impl<'a> !Send for Event<'a>
impl<'a> !Sync for Event<'a>
impl<'a> !UnwindSafe for Event<'a>
impl<'a> Freeze for Event<'a>
impl<'a> Unpin for Event<'a>
impl<'a> UnsafeUnpin for Event<'a>
Blanket Implementations
impl<T> Any for Event<'a>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Event<'a>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Event<'a>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Event<'a>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for Event<'a>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Event<'a>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Event<'a>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>