pub struct LogfireConfigBuilder { /* private fields */ }Expand description
Builder for logfire configuration, returned from logfire::configure().
Implementations§
Source§impl LogfireConfigBuilder
impl LogfireConfigBuilder
Sourcepub fn install_panic_handler(self) -> Self
pub fn install_panic_handler(self) -> Self
Call to install a hook to log panics.
Any existing panic hook will be preserved and called after the logfire panic hook.
Sourcepub fn send_to_logfire<T: Into<SendToLogfire>>(self, send_to_logfire: T) -> Self
pub fn send_to_logfire<T: Into<SendToLogfire>>(self, send_to_logfire: T) -> Self
Whether to send data to the Logfire platform.
Defaults to the value of LOGFIRE_SEND_TO_LOGFIRE if set, otherwise Yes.
Sourcepub fn with_token<T: Into<String>>(self, token: T) -> Self
pub fn with_token<T: Into<String>>(self, token: T) -> Self
The token to use for the Logfire platform.
Defaults to the value of LOGFIRE_TOKEN if set.
Sourcepub fn console_mode(self, console_mode: ConsoleMode) -> Self
👎Deprecated since 0.4.0: use with_console() instead
pub fn console_mode(self, console_mode: ConsoleMode) -> Self
with_console() insteadWhether to log to the console.
Sourcepub fn with_console(self, console_options: Option<ConsoleOptions>) -> Self
pub fn with_console(self, console_options: Option<ConsoleOptions>) -> Self
Sets console options. Set to None to disable console logging.
If not set, will use ConsoleOptions::default().
Sourcepub fn with_default_level_filter(
self,
default_level_filter: LevelFilter,
) -> Self
pub fn with_default_level_filter( self, default_level_filter: LevelFilter, ) -> Self
Override the filter used for traces and logs.
By default this is set to LevelFilter::TRACE if sending to logfire, or LevelFilter::INFO if not.
The RUST_LOG environment variable will override this.
Sourcepub fn with_additional_span_processor<T: SpanProcessor + 'static>(
self,
span_processor: T,
) -> Self
pub fn with_additional_span_processor<T: SpanProcessor + 'static>( self, span_processor: T, ) -> Self
Add an additional span processor to process spans alongside the main logfire exporter.
To disable the main logfire exporter, set send_to_logfire to false.
Sourcepub fn with_advanced_options(self, advanced: AdvancedOptions) -> Self
pub fn with_advanced_options(self, advanced: AdvancedOptions) -> Self
Configure advanced options.
Sourcepub fn with_metrics(self, metrics: Option<MetricsOptions>) -> Self
pub fn with_metrics(self, metrics: Option<MetricsOptions>) -> Self
Configure metrics options.
Set to None to disable metrics.
Sourcepub fn with_metrics_options(self, metrics: MetricsOptions) -> Self
👎Deprecated since 0.4.0: use with_metrics instead
pub fn with_metrics_options(self, metrics: MetricsOptions) -> Self
with_metrics insteadConfigure metrics options.
Sourcepub fn enable_metrics(self, enable: bool) -> Self
👎Deprecated since 0.4.0: use with_metrics(None) to disable metrics
pub fn enable_metrics(self, enable: bool) -> Self
with_metrics(None) to disable metricsWhether to enable metrics.
Sourcepub fn finish(self) -> Result<ShutdownHandler, ConfigureError>
pub fn finish(self) -> Result<ShutdownHandler, ConfigureError>
Finish configuring Logfire.
Because this configures global state for the opentelemetry SDK, this can typically only ever be called once per program.
§Errors
See ConfigureError for possible errors.