pub struct LogSubscriptionOptions { /* private fields */ }Expand description
Filtering and queue budgets for a shared log subscription.
Defaults: all real levels (Debug), 256 queued records, 16 KiB per record,
and 1 MiB of queued/reserved payload bytes. These are policy defaults, not
measurements of an application’s logging needs.
Payload bytes are the sum of location.len(), tag.len() and content.len()
in UTF-8. Each subscription accounts for its own logical bytes even when
records share storage. The budget includes brief reservations before enqueue,
but excludes dequeued records, user-retained records, allocation overhead and
formatting temporaries. It is not a process memory or allocation limit.
Implementations§
Source§impl LogSubscriptionOptions
impl LogSubscriptionOptions
Sourcepub fn new(log_types: &[LogType]) -> Self
pub fn new(log_types: &[LogType]) -> Self
Selects explicit origins with the documented default levels and budgets. An empty origin list is rejected when registering the subscription.
Sourcepub fn with_max_level(self, level: LogLevel) -> Self
pub fn with_max_level(self, level: LogLevel) -> Self
Accepts real levels up to this value: Warn accepts Error and Warn,
Debug accepts all real levels, and None disables this subscription.
A record whose level is None is never accepted by a shared subscription.
Sourcepub fn with_queue_capacity(self, records: usize) -> Self
pub fn with_queue_capacity(self, records: usize) -> Self
Sets the number of waiting records, excluding the running callback.
Registration rejects values outside 1..=16_384.
Sourcepub fn with_max_record_bytes(self, bytes: usize) -> Self
pub fn with_max_record_bytes(self, bytes: usize) -> Self
Sets the maximum logical payload bytes of one record, including synthetic overflow reports. Registration rejects zero or a value greater than the queued-byte budget. Oversized records are dropped whole, never truncated. The check happens after formatting and cannot bound parameter allocations.
Sourcepub fn with_max_queued_bytes(self, bytes: usize) -> Self
pub fn with_max_queued_bytes(self, bytes: usize) -> Self
Sets the logical payload budget for queued records and pending enqueue reservations. Registration rejects zero or a value below the single-record limit. Bytes are released before invoking the callback, or when an enqueue fails or a queued record is destroyed.