pub struct BetterstackConfigBuilder { /* private fields */ }Expand description
Builder for BetterstackConfig
Implementations§
Source§impl BetterstackConfigBuilder
impl BetterstackConfigBuilder
Sourcepub fn endpoint(self, endpoint: impl Into<String>) -> Self
pub fn endpoint(self, endpoint: impl Into<String>) -> Self
Set the Betterstack endpoint URL
Default: https://in.logs.betterstack.com/
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Set the HTTP request timeout
Default: 10 seconds
Sourcepub fn batch_size(self, size: usize) -> Self
pub fn batch_size(self, size: usize) -> Self
Set the maximum batch size (number of logs)
Default: 10
Sourcepub fn batch_delay(self, delay: Duration) -> Self
pub fn batch_delay(self, delay: Duration) -> Self
Set the maximum batch delay (time before flush)
Default: 2 seconds
Sourcepub fn channel_capacity(self, capacity: usize) -> Self
pub fn channel_capacity(self, capacity: usize) -> Self
Set the channel capacity (max queued logs)
Default: 1000
Sourcepub fn include_span_context(self, include: bool) -> Self
pub fn include_span_context(self, include: bool) -> Self
Set whether to include span context in logs
Default: true
Sourcepub fn logger_name(self, name: impl Into<String>) -> Self
pub fn logger_name(self, name: impl Into<String>) -> Self
Set the logger name
Default: “tracing-betterstack”
Sourcepub fn logger_version(self, version: impl Into<String>) -> Self
pub fn logger_version(self, version: impl Into<String>) -> Self
Set the logger version
Default: crate version
Sourcepub fn on_error<F>(self, callback: F) -> Self
pub fn on_error<F>(self, callback: F) -> Self
Set an error callback function
This function will be called when errors occur during log sending. Useful for monitoring and debugging.
Sourcepub fn build(self) -> Result<BetterstackConfig>
pub fn build(self) -> Result<BetterstackConfig>
Build the configuration
§Errors
Returns an error if:
- Token is empty
- Batch size is 0
- Channel capacity is 0
- Timeout is 0
Auto Trait Implementations§
impl Freeze for BetterstackConfigBuilder
impl !RefUnwindSafe for BetterstackConfigBuilder
impl Send for BetterstackConfigBuilder
impl Sync for BetterstackConfigBuilder
impl Unpin for BetterstackConfigBuilder
impl !UnwindSafe for BetterstackConfigBuilder
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
Mutably borrows from an owned value. Read more