pub enum LogFormat {
Json,
LogFmt,
Terminal,
}std only.Expand description
Represents the logging format.
This enum defines the supported formats for logging output. It is used to configure the format layer of a tracing subscriber.
Variants§
Json
Represents JSON formatting for logs. This format outputs log records as JSON objects, making it suitable for structured logging.
LogFmt
Represents logfmt (key=value) formatting for logs. This format is concise and human-readable, typically used in command-line applications.
Terminal
Represents terminal-friendly formatting for logs.
Implementations§
Source§impl LogFormat
impl LogFormat
Sourcepub fn apply<F>(
&self,
filter: F,
color: Option<String>,
show_target: bool,
file_writer: Option<NonBlocking>,
) -> Box<dyn Layer<Registry> + Send + Sync>
pub fn apply<F>( &self, filter: F, color: Option<String>, show_target: bool, file_writer: Option<NonBlocking>, ) -> Box<dyn Layer<Registry> + Send + Sync>
Applies the specified logging format to create a new layer.
§Arguments
filter- A filter layer (eitherEnvFilteror areload::Layerwrapping one).color- An optional string that enables or disables ANSI color codes in the logs.show_target- Whether to show the target module path in log output.file_writer- An optional [NonBlocking] writer for directing logs to a file. WhenNone, logs are written to stdout.
§Returns
A BoxedLayer<Registry> that can be added to a tracing subscriber.
§Environment
RUST_LOG_THREAD_IDS- Set to any value other than0to include the emitting thread’s ID in log output. Thread IDs are omitted when it is unset. JSON and terminal output show the Ruststd::thread::ThreadId, while logfmt output shows the OS thread ID.
Trait Implementations§
impl Copy for LogFormat
impl Eq for LogFormat
impl StructuralPartialEq for LogFormat
Auto Trait Implementations§
impl Freeze for LogFormat
impl RefUnwindSafe for LogFormat
impl Send for LogFormat
impl Sync for LogFormat
impl Unpin for LogFormat
impl UnsafeUnpin for LogFormat
impl UnwindSafe for LogFormat
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 1 byte
Size for each variant:
Json: 0 bytesLogFmt: 0 bytesTerminal: 0 bytes