pub struct OmaFormatter { /* private fields */ }Expand description
OmaFormatter
OmaFormatter is used for outputting oma-style logs to spdlog-rs
§Example:
use spdlog::{info, sink::StdStreamSink, Logger, Result};
use oma_console::OmaFormatter;
use std::sync::Arc;
fn main() -> Result<()> {
let mut logger_builder = Logger::builder();
let stream_sink = StdStreamSink::builder()
.formatter(OmaFormatter::default())
.stdout()
.build()?;
let logger = logger_builder.sink(Arc::new(stream_sink)).build()?;
spdlog::set_default_logger(Arc::new(logger));
info!("My name is oma!");
Ok(())
}Implementations§
Source§impl OmaFormatter
impl OmaFormatter
pub fn new() -> Self
Sourcepub fn with_ansi(self, with_ansi: bool) -> Self
pub fn with_ansi(self, with_ansi: bool) -> Self
Display with ANSI colors
Set to false to disable ANSI color sequences.
pub fn with_file(self, with_file: bool) -> Self
pub fn with_time(self, with_time: bool) -> Self
pub fn with_kv(self, with_kv: bool) -> Self
pub fn with_max_len(self, max_len: Option<u16>) -> Self
pub fn with_debug(self, debug: bool) -> Self
pub fn with_prefix_len(self, prefix_len: u16) -> Self
pub fn with_term(self, term: Terminal) -> Self
pub fn get_term(&self) -> &Terminal
Trait Implementations§
Source§impl Clone for OmaFormatter
impl Clone for OmaFormatter
Source§fn clone(&self) -> OmaFormatter
fn clone(&self) -> OmaFormatter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for OmaFormatter
impl Default for OmaFormatter
Auto Trait Implementations§
impl Freeze for OmaFormatter
impl RefUnwindSafe for OmaFormatter
impl Send for OmaFormatter
impl Sync for OmaFormatter
impl Unpin for OmaFormatter
impl UnwindSafe for OmaFormatter
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more