pub struct LogService { /* private fields */ }Expand description
Structured logging service with ring buffer and query support.
Stores log entries in a bounded ring buffer (oldest evicted when full).
Supports query by PID, service, level, time range, and trace ID.
Real-time subscribers receive entries via mpsc channels.
Implementations§
Source§impl LogService
impl LogService
Sourcepub fn with_default_capacity() -> Self
pub fn with_default_capacity() -> Self
Create a log service with default capacity (100,000).
Sourcepub fn ingest(&self, entry: LogEntry)
pub fn ingest(&self, entry: LogEntry)
Ingest a log entry.
Stores in the ring buffer and fans out to all subscribers. Write lock is released before subscriber notification to prevent blocking on slow consumers.
Sourcepub fn log(&self, level: LogLevel, message: impl Into<String>, pid: Option<Pid>)
pub fn log(&self, level: LogLevel, message: impl Into<String>, pid: Option<Pid>)
Log a convenience method: ingest with level, message, and optional PID.
Sourcepub fn query(&self, query: &LogQuery) -> Vec<LogEntry>
pub fn query(&self, query: &LogQuery) -> Vec<LogEntry>
Query log entries matching the given criteria.
Sourcepub fn subscribe(&self) -> (String, Receiver<LogEntry>)
pub fn subscribe(&self) -> (String, Receiver<LogEntry>)
Subscribe to real-time log entries.
Returns a receiver that will receive all new log entries. The subscription ID can be used to unsubscribe.
Sourcepub fn unsubscribe(&self, id: &str)
pub fn unsubscribe(&self, id: &str)
Unsubscribe from real-time log entries.
Sourcepub fn subscriber_count(&self) -> usize
pub fn subscriber_count(&self) -> usize
Number of active subscribers.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for LogService
impl !RefUnwindSafe for LogService
impl Send for LogService
impl Sync for LogService
impl Unpin for LogService
impl UnsafeUnpin for LogService
impl UnwindSafe for LogService
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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more