pub struct HumanFormat { /* private fields */ }Available on crate feature
human only.Expand description
Human-readable formatter.
§Example
use log_io::format::{Format, HumanFormat};
use log_io::{Field, Level, Metadata, Record, Value};
let fmt = HumanFormat::new();
let fields = [Field::new("port", Value::U64(8080))];
let record = Record::new(Metadata::new(Level::Info, "app"), "ok", &fields);
let mut out = String::new();
fmt.write_record(&record, &mut out).unwrap();
assert!(out.contains("INFO "));
assert!(out.contains("[app]"));
assert!(out.ends_with('\n'));Implementations§
Source§impl HumanFormat
impl HumanFormat
Sourcepub const fn new() -> Self
pub const fn new() -> Self
New formatter with sensible defaults: target shown, source location hidden.
Sourcepub const fn show_target(self, enabled: bool) -> Self
pub const fn show_target(self, enabled: bool) -> Self
Toggle the [target] column.
Sourcepub const fn show_source_location(self, enabled: bool) -> Self
pub const fn show_source_location(self, enabled: bool) -> Self
Toggle inclusion of the file:line suffix when the record
carries source location metadata.
Trait Implementations§
Source§impl Clone for HumanFormat
impl Clone for HumanFormat
Source§fn clone(&self) -> HumanFormat
fn clone(&self) -> HumanFormat
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HumanFormat
impl Debug for HumanFormat
Source§impl Default for HumanFormat
impl Default for HumanFormat
Source§impl Format for HumanFormat
impl Format for HumanFormat
impl Copy for HumanFormat
Auto Trait Implementations§
impl Freeze for HumanFormat
impl RefUnwindSafe for HumanFormat
impl Send for HumanFormat
impl Sync for HumanFormat
impl Unpin for HumanFormat
impl UnsafeUnpin for HumanFormat
impl UnwindSafe for HumanFormat
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
Mutably borrows from an owned value. Read more