pub struct EventLogger { /* private fields */ }Expand description
Sends pre-serialized event JSON lines to the background writer task via an mpsc channel.
log() is non-blocking: if the channel is full (capacity 1024), the event
is dropped with a warning rather than blocking the verdict path.
§Architecture
EventLogger is the sender side; EventLoggerHandle owns the background task.
The caller must drop EventLogger before calling EventLoggerHandle::shutdown()
so the writer task sees the channel close and exits cleanly.
Events are accepted as pre-serialized JSON strings to avoid double serialization (struct → Value → String). The caller serializes once; the writer appends as-is.
Implementations§
Source§impl EventLogger
impl EventLogger
Sourcepub fn new(log_dir: PathBuf) -> (Self, EventLoggerHandle)
pub fn new(log_dir: PathBuf) -> (Self, EventLoggerHandle)
Create a new EventLogger and its background writer task.
Returns the logger (sender) and the handle (task owner) as a pair.
The caller must hold the EventLoggerHandle until the daemon shuts down.
Trait Implementations§
Source§impl Clone for EventLogger
impl Clone for EventLogger
Source§fn clone(&self) -> EventLogger
fn clone(&self) -> EventLogger
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more