pub struct LockFreeEngine { /* private fields */ }Expand description
The near-lock-free ingestion engine.
Owns the ring buffer, flusher thread, and TUI metrics counters.
Access the global instance via ENGINE.
Implementations§
Source§impl LockFreeEngine
impl LockFreeEngine
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
Create a new engine with the given buffer capacity and spawn the flusher.
§Panics
Panics if the OS cannot spawn the background flusher thread.
Sourcepub fn ingest(&self, event: LogEvent)
pub fn ingest(&self, event: LogEvent)
Appends an event to the ring buffer.
If the buffer is full, the oldest event is evicted to make room.
Dropped events are tracked via TuiMetrics::dropped_events.
The event, level, error and format counters are updated as the
flusher drains each event (or when one is dropped), so they
trail ingest by at most one flush.
Sourcepub fn set_filter(&self, level: u8)
pub fn set_filter(&self, level: u8)
Sets the global log level filter.
Sourcepub fn filter_level(&self) -> u8
pub fn filter_level(&self) -> u8
Returns the current global log level filter.
Sourcepub fn inc_format(&self, format: LogFormat)
pub fn inc_format(&self, format: LogFormat)
Increments the format counter in the TUI metrics.
The engine counts each event’s format itself as it drains it;
call this only for records that bypass Self::ingest.
Sourcepub fn active_spans(&self) -> usize
pub fn active_spans(&self) -> usize
Returns the current number of active spans.
Sourcepub fn apply_config(&self, config: &Config)
pub fn apply_config(&self, config: &Config)
Applies configuration settings to the engine.
Sets the log level filter from the config. File sink construction
and rotation are handled by the flusher thread at startup via
PlatformSink::from_config.