Struct LogfireConfigBuilder

Source
pub struct LogfireConfigBuilder { /* private fields */ }
Expand description

Builder for logfire configuration, returned from logfire::configure().

Implementations§

Source§

impl LogfireConfigBuilder

Source

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.

Source

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.

Source

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.

Source

pub fn console_mode(self, console_mode: ConsoleMode) -> Self

👎Deprecated since 0.4.0: use with_console() instead

Whether to log to the console.

Source

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().

Source

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.

Source

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.

Source

pub fn with_advanced_options(self, advanced: AdvancedOptions) -> Self

Configure advanced options.

Source

pub fn with_metrics(self, metrics: Option<MetricsOptions>) -> Self

Configure metrics options.

Set to None to disable metrics.

Source

pub fn with_metrics_options(self, metrics: MetricsOptions) -> Self

👎Deprecated since 0.4.0: use with_metrics instead

Configure metrics options.

Source

pub fn enable_metrics(self, enable: bool) -> Self

👎Deprecated since 0.4.0: use with_metrics(None) to disable metrics

Whether to enable metrics.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,