Type Alias LogsData

Source
pub type LogsData = Data<Logs>;
Expand description

A diagnostics data object containing logs data.

Aliased Type§

struct LogsData {
    pub data_source: DataSource,
    pub metadata: LogsMetadata,
    pub moniker: ExtendedMoniker,
    pub payload: Option<DiagnosticsHierarchy<LogsField>>,
    pub version: u64,
}

Fields§

§data_source: DataSource

The source of the data.

§metadata: LogsMetadata

The metadata for the diagnostics payload.

§moniker: ExtendedMoniker

Moniker of the component that generated the payload.

§payload: Option<DiagnosticsHierarchy<LogsField>>

Payload containing diagnostics data, if the payload exists, else None.

§version: u64

Schema version.

Implementations

Source§

impl<D> Data<D>
where D: DiagnosticsData,

Source

pub fn drop_payload(&mut self)

Returns a Data with an error indicating that the payload was dropped.

Source

pub fn sort_payload(&mut self)

Sorts this Data’s payload if one is present.

Source

pub fn filter(self, selectors: &[Selector]) -> Result<Option<Self>, Error>

Uses a set of Selectors to filter self’s payload and returns the resulting Data. If the resulting payload is empty, it returns Ok(None).

Source§

impl Data<Logs>

Source

pub fn for_logs( moniker: ExtendedMoniker, payload: Option<LogsHierarchy>, timestamp: impl Into<Timestamp>, component_url: Option<FlyStr>, severity: impl Into<Severity>, errors: Vec<LogError>, ) -> Self

Creates a new data instance for logs.

Source

pub fn set_raw_severity(&mut self, raw_severity: u8)

Sets the severity from a raw severity number. Overrides the severity to match the raw severity.

Source

pub fn set_severity(&mut self, severity: Severity)

Sets the severity of the log. This will unset the raw severity.

Source

pub fn msg(&self) -> Option<&str>

Returns the string log associated with the message, if one exists.

Source

pub fn msg_mut(&mut self) -> Option<&mut String>

If the log has a message, returns a shared reference to the message contents.

Source

pub fn payload_message(&self) -> Option<&DiagnosticsHierarchy<LogsField>>

If the log has message, returns an exclusive reference to it.

Source

pub fn payload_keys(&self) -> Option<&DiagnosticsHierarchy<LogsField>>

If the log has structured keys, returns an exclusive reference to them.

Source

pub fn metadata(&self) -> &LogsMetadata

Source

pub fn payload_keys_strings(&self) -> Box<dyn Iterator<Item = String> + '_>

Returns an iterator over the payload keys as strings with the format “key=value”.

Source

pub fn payload_message_mut( &mut self, ) -> Option<&mut DiagnosticsHierarchy<LogsField>>

If the log has a message, returns a mutable reference to it.

Source

pub fn file_path(&self) -> Option<&str>

Returns the file path associated with the message, if one exists.

Source

pub fn line_number(&self) -> Option<&u64>

Returns the line number associated with the message, if one exists.

Source

pub fn pid(&self) -> Option<u64>

Returns the pid associated with the message, if one exists.

Source

pub fn tid(&self) -> Option<u64>

Returns the tid associated with the message, if one exists.

Source

pub fn tags(&self) -> Option<&Vec<String>>

Returns the tags associated with the message, if any exist.

Source

pub fn severity(&self) -> Severity

Returns the severity level of this log.

Source

pub fn dropped_logs(&self) -> Option<u64>

Returns number of dropped logs if reported in the message.

Source

pub fn rolled_out_logs(&self) -> Option<u64>

Returns number of rolled out logs if reported in the message.

Source

pub fn component_name(&self) -> Cow<'_, str>

Returns the component name. This only makes sense for v1 components.

Trait Implementations

Source§

impl<D: Clone + DiagnosticsData> Clone for Data<D>
where D::Metadata: Clone, D::Key: Clone,

Source§

fn clone(&self) -> Data<D>

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<D: Debug + DiagnosticsData> Debug for Data<D>
where D::Metadata: Debug, D::Key: Debug,

Source§

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

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

impl<'de, D: DiagnosticsData> Deserialize<'de> for Data<D>

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 Display for Data<Logs>

Source§

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

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

impl Ord for Data<Logs>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<D: PartialEq + DiagnosticsData> PartialEq for Data<D>

Source§

fn eq(&self, other: &Data<D>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Data<Logs>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<D: DiagnosticsData> Serialize for Data<D>
where D::Metadata: Serialize,

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
Source§

impl Eq for Data<Logs>

Source§

impl<D: DiagnosticsData> StructuralPartialEq for Data<D>