pub struct LogEntry {
pub level: LogLevel,
pub timestamp: SystemTime,
pub message: String,
pub error: Option<LarkAPIError>,
pub category: Option<ErrorHandlingCategory>,
pub error_code: Option<LarkErrorCode>,
pub context: HashMap<String, String>,
pub caller: Option<String>,
}Expand description
日志条目
Fields§
§level: LogLevel日志级别
timestamp: SystemTime时间戳
message: String消息
error: Option<LarkAPIError>错误信息(如果有)
category: Option<ErrorHandlingCategory>错误分类
error_code: Option<LarkErrorCode>错误码
context: HashMap<String, String>上下文信息
caller: Option<String>调用栈信息
Implementations§
Source§impl LogEntry
impl LogEntry
Sourcepub fn from_error_event(event: &ErrorEvent) -> Self
pub fn from_error_event(event: &ErrorEvent) -> Self
从错误事件创建日志条目
Sourcepub fn with_context(self, key: &str, value: &str) -> Self
pub fn with_context(self, key: &str, value: &str) -> Self
添加上下文信息
Sourcepub fn with_caller(self, caller: String) -> Self
pub fn with_caller(self, caller: String) -> Self
添加调用者信息
Sourcepub fn with_error(self, error: LarkAPIError) -> Self
pub fn with_error(self, error: LarkAPIError) -> Self
设置错误信息
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