pub struct FullFormatter { /* private fields */ }Expand description
Full information logs formatter.
It is the default formatter for most sinks. By default, all fields are
enabled. Use FullFormatter::builder to opt-out of fields as needed, and
corresponding information for disabled fields will be removed from the
formatted output.
§Examples
-
If all fields are enabled, log messages formatted by it look like:
-
Default:
[2022-11-02 09:23:12.263] [info] hello, world! { key1=value1 key2=value2 } -
If the logger has a name:
[2022-11-02 09:23:12.263] [logger-name] [info] hello, world! { key1=value1 key2=value2 } -
If crate feature
source-locationis enabled:[2022-11-02 09:23:12.263] [logger-name] [info] [mod::path, src/main.rs:4] hello, world! { key1=value1 key2=value2 }
-
-
Disabling some fields will remove corresponding information:
use spdlog::formatter::FullFormatter;
let formatter = FullFormatter::builder()
.time(false)
.source_location(false)
.build();
// ... Setting up sinks with the formatter
info!(logger: doctest, "Interesting log message");
/* Output */ "[info] Interesting log message\n"
let formatter = FullFormatter::builder()
.time(false)
.level(false)
.source_location(false)
.build();
// ... Setting up sinks with the formatter
info!(logger: doctest, "Interesting log message");
/* Output */ "Interesting log message\n"Implementations§
Source§impl FullFormatter
impl FullFormatter
Sourcepub fn new() -> FullFormatter
pub fn new() -> FullFormatter
Constructs a FullFormatter.
See FullFormatter::builder for the default parameters will be used.
Sourcepub fn builder() -> FullFormatterBuilder
pub fn builder() -> FullFormatterBuilder
Gets a builder of FullFormatter with default parameters:
| Parameter | Default Value |
|---|---|
| time | true |
| logger_name | true |
| level | true |
| source_location | true |
| kv | true |
| eol | true |
Trait Implementations§
Source§impl Clone for FullFormatter
impl Clone for FullFormatter
Source§fn clone(&self) -> FullFormatter
fn clone(&self) -> FullFormatter
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for FullFormatter
impl Default for FullFormatter
Source§fn default() -> FullFormatter
fn default() -> FullFormatter
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for FullFormatter
impl RefUnwindSafe for FullFormatter
impl Send for FullFormatter
impl Sync for FullFormatter
impl Unpin for FullFormatter
impl UnwindSafe for FullFormatter
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)