pub struct Log {
pub session_id: String,
pub time: String,
pub level: LogLevel,
pub component: String,
pub description: String,
pub format: LogFormat,
}
Expand description
The Log
struct provides an easy way to log a message to the console.
It contains a set of defined fields to create a simple log message with a readable output format.
Fields§
§session_id: String
The session ID for the log entry.
time: String
The time the log entry was created.
level: LogLevel
The log level of the message.
component: String
The component that generated the log message.
description: String
The description of the log message.
format: LogFormat
The format of the log message.
Implementations§
Source§impl Log
impl Log
Sourcepub async fn log(&self) -> RlgResult<()>
pub async fn log(&self) -> RlgResult<()>
Logs a message asynchronously using a pre-allocated buffer to reduce memory allocation.
This function formats the log message according to the specified log format and writes it to both the log file and standard output. It ensures that the log file is flushed after every write to guarantee data persistence.
§Returns
RlgResult<()>
- Result withOk(())
if the logging succeeds, orRlgError
if any errors occur.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Log
impl<'de> Deserialize<'de> for Log
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 PartialOrd for Log
impl PartialOrd for Log
impl Eq for Log
impl StructuralPartialEq for Log
Auto Trait Implementations§
impl Freeze for Log
impl RefUnwindSafe for Log
impl Send for Log
impl Sync for Log
impl Unpin for Log
impl UnwindSafe for Log
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.