pub struct BaseLogEntry {
pub timestamp: DateTime<Utc>,
pub request_id: Option<String>,
pub message: Option<String>,
pub tags: Option<HashMap<String, Value>>,
}
Expand description
Base log entry structure shared by all log types This structure is used to serialize log entries to JSON and send them to the log sinks This structure is also used to deserialize log entries from JSON This structure is also used to store log entries in the database This structure is also used to query log entries from the database
The BaseLogEntry
structure contains the following fields:
timestamp
- the timestamp of the log entryrequest_id
- the request ID of the log entrymessage
- the message of the log entrytags
- the tags of the log entry
The BaseLogEntry
structure contains the following methods:
new
- create a newBaseLogEntry
with default valuesmessage
- set the messagerequest_id
- set the request IDtags
- set the tagstimestamp
- set the timestamp
§Example
use rustfs_obs::BaseLogEntry;
use chrono::{DateTime, Utc};
use std::collections::HashMap;
let timestamp = Utc::now();
let request = Some("req-123".to_string());
let message = Some("This is a log message".to_string());
let tags = Some(HashMap::new());
let entry = BaseLogEntry::new()
.timestamp(timestamp)
.request_id(request)
.message(message)
.tags(tags);
Fields§
§timestamp: DateTime<Utc>
§request_id: Option<String>
§message: Option<String>
Implementations§
Source§impl BaseLogEntry
impl BaseLogEntry
Sourcepub fn request_id(self, request_id: Option<String>) -> Self
pub fn request_id(self, request_id: Option<String>) -> Self
Set the request ID
Set the tags
Trait Implementations§
Source§impl Clone for BaseLogEntry
impl Clone for BaseLogEntry
Source§fn clone(&self) -> BaseLogEntry
fn clone(&self) -> BaseLogEntry
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for BaseLogEntry
impl Debug for BaseLogEntry
Source§impl Default for BaseLogEntry
impl Default for BaseLogEntry
Source§fn default() -> BaseLogEntry
fn default() -> BaseLogEntry
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for BaseLogEntry
impl<'de> Deserialize<'de> for BaseLogEntry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 PartialEq for BaseLogEntry
impl PartialEq for BaseLogEntry
Source§impl Serialize for BaseLogEntry
impl Serialize for BaseLogEntry
impl Eq for BaseLogEntry
impl StructuralPartialEq for BaseLogEntry
Auto Trait Implementations§
impl Freeze for BaseLogEntry
impl RefUnwindSafe for BaseLogEntry
impl Send for BaseLogEntry
impl Sync for BaseLogEntry
impl Unpin for BaseLogEntry
impl UnwindSafe for BaseLogEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request