pub struct LogEntry {
pub severity: String,
pub message: String,
pub service_name: Option<String>,
pub log_name: Option<String>,
pub json_payload: Option<Value>,
pub labels: Option<HashMap<String, String>>,
pub insert_id: Option<String>,
}Expand description
Log entry data for Cloud Logging
Fields§
§severity: String§message: String§service_name: Option<String>§log_name: Option<String>§json_payload: Option<Value>§labels: Option<HashMap<String, String>>§insert_id: Option<String>Implementations§
Source§impl LogEntry
impl LogEntry
pub fn new(severity: impl Into<String>, message: impl Into<String>) -> Self
Sourcepub fn new_json(severity: impl Into<String>, json_payload: Value) -> Self
pub fn new_json(severity: impl Into<String>, json_payload: Value) -> Self
Create a structured log entry using Cloud Logging jsonPayload.
When json_payload is set, the message field is not used for the payload.
pub fn with_service_name(self, service_name: impl Into<String>) -> Self
pub fn with_log_name(self, log_name: impl Into<String>) -> Self
Sourcepub fn with_json_payload(self, json_payload: Value) -> Self
pub fn with_json_payload(self, json_payload: Value) -> Self
Set the Cloud Logging jsonPayload.
Sourcepub fn with_labels(self, labels: HashMap<String, String>) -> Self
pub fn with_labels(self, labels: HashMap<String, String>) -> Self
Replace all labels with the provided map.
Sourcepub fn with_label(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_label( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add a single label (merging with existing labels).
Sourcepub fn with_insert_id(self, insert_id: impl Into<String>) -> Self
pub fn with_insert_id(self, insert_id: impl Into<String>) -> Self
Set a custom insertId for deduplication.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LogEntry
impl RefUnwindSafe for LogEntry
impl Send for LogEntry
impl Sync for LogEntry
impl Unpin for LogEntry
impl UnwindSafe for LogEntry
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<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