pub struct StructuredLogEntry {
pub level: LogLevel,
pub message: String,
pub timestamp: String,
pub target: Option<String>,
pub fields: StructuredFields,
}Expand description
Fields§
§level: LogLevel§message: String§timestamp: String§target: Option<String>§fields: StructuredFieldsImplementations§
Source§impl StructuredLogEntry
impl StructuredLogEntry
Sourcepub fn with_target(self, target: impl Into<String>) -> Self
pub fn with_target(self, target: impl Into<String>) -> Self
设置 target(模块名)
Sourcepub fn from_log_entry(entry: &LogEntry) -> Self
pub fn from_log_entry(entry: &LogEntry) -> Self
从普通 LogEntry 转换(target 和 fields 为空)
Sourcepub fn to_log_entry(&self) -> LogEntry
pub fn to_log_entry(&self) -> LogEntry
转换为普通 LogEntry(丢弃 target 和 fields)
Sourcepub fn format_fields(&self) -> String
pub fn format_fields(&self) -> String
将结构化字段格式化为 key=value 列表(用于日志文本输出)
Source§impl StructuredLogEntry
impl StructuredLogEntry
Sourcepub fn with_fields(self, fields: StructuredFields) -> Self
pub fn with_fields(self, fields: StructuredFields) -> Self
批量设置结构化字段
Trait Implementations§
Source§impl Clone for StructuredLogEntry
impl Clone for StructuredLogEntry
Source§fn clone(&self) -> StructuredLogEntry
fn clone(&self) -> StructuredLogEntry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StructuredLogEntry
impl Debug for StructuredLogEntry
Source§impl<'de> Deserialize<'de> for StructuredLogEntry
impl<'de> Deserialize<'de> for StructuredLogEntry
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
Auto Trait Implementations§
impl Freeze for StructuredLogEntry
impl RefUnwindSafe for StructuredLogEntry
impl Send for StructuredLogEntry
impl Sync for StructuredLogEntry
impl Unpin for StructuredLogEntry
impl UnsafeUnpin for StructuredLogEntry
impl UnwindSafe for StructuredLogEntry
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