Struct slog_loggly::LogglyDrainBuilder
source · pub struct LogglyDrainBuilder<F = AcceptAll> { /* private fields */ }
Expand description
Loggly drain builder.
Implementations§
source§impl<F> LogglyDrainBuilder<F>
impl<F> LogglyDrainBuilder<F>
sourcepub fn kv_filter<K, T>(
self,
fallback_field: K,
filter: T
) -> LogglyDrainBuilder<T>where
K: Into<Key>,
pub fn kv_filter<K, T>(
self,
fallback_field: K,
filter: T
) -> LogglyDrainBuilder<T>where
K: Into<Key>,
Use a given key-value pair filter.
All key-value pairs rejected by the given filter will be serialized under a given fallback field.
This feature can be used if you want Loggly to index only a given subset of fields.
sourcepub fn debug_mode(self, enable: bool) -> Self
pub fn debug_mode(self, enable: bool) -> Self
Enable or disable debug mode (it’s disabled by default). In the debug mode you’ll be able to see some runtime info on stderr that will help you with setting up the drain (e.g. failed requests). With debug mode disabled, all errors will be silently ignored.
sourcepub fn queue_max_size(self, size: usize) -> Self
pub fn queue_max_size(self, size: usize) -> Self
Set a given maximum size of the message queue (the default is unlimited).
sourcepub fn batch_size(self, size: usize) -> Self
pub fn batch_size(self, size: usize) -> Self
Maximum number of messages sent in one batch (the default is 20). Please note that all log messages are sent as soon as possible. Increasing batch size won’t cause any delays in sending messages. If there is not enough messages in the internal queue to make a maximum size batch, a smaller batch is sent.
sourcepub fn sender_count(self, count: usize) -> Self
pub fn sender_count(self, count: usize) -> Self
Set the number of concurrent senders (the default is 16).
sourcepub fn request_timeout(self, timeout: Duration) -> Self
pub fn request_timeout(self, timeout: Duration) -> Self
Set Loggly request timeout (the default is 5 seconds).
sourcepub fn connector(self, connector: HttpsConnector<HttpConnector>) -> Self
pub fn connector(self, connector: HttpsConnector<HttpConnector>) -> Self
Use a given HttpsConnector. The connector is used only if the log message sender is spawned as a task.
sourcepub fn build(
self
) -> Result<(LogglyDrain<F>, LogglyMessageSender, FlushHandle), Error>
pub fn build(
self
) -> Result<(LogglyDrain<F>, LogglyMessageSender, FlushHandle), Error>
Build a Loggly drain.
sourcepub fn spawn_task(self) -> Result<(LogglyDrain<F>, FlushHandle), Error>
pub fn spawn_task(self) -> Result<(LogglyDrain<F>, FlushHandle), Error>
Spawn a tokio task within the current executor context. The task will be responsible for sending all log messages.
sourcepub fn spawn_thread(self) -> Result<(LogglyDrain<F>, FlushHandle), Error>
pub fn spawn_thread(self) -> Result<(LogglyDrain<F>, FlushHandle), Error>
Spawn a thread responsible for sending all log messages.