pub enum LogFormat {
Json,
LogFmt,
Terminal,
}
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(
&self,
filter: EnvFilter,
color: Option<String>,
file_writer: Option<NonBlocking>,
) -> Box<dyn Layer<Registry> + Send + Sync>
pub fn apply( &self, filter: EnvFilter, color: Option<String>, file_writer: Option<NonBlocking>, ) -> Box<dyn Layer<Registry> + Send + Sync>
Applies the specified logging format to create a new layer.
This method constructs a tracing layer with the selected format, along with additional configurations for filtering and output.
§Arguments
filter
- AnEnvFilter
used to determine which log records to output.color
- An optional string that enables or disables ANSI color codes in the logs.file_writer
- An optionalNonBlocking
writer for directing logs to a file.
§Returns
A BoxedLayer<Registry>
that can be added to a tracing subscriber.
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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§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