pub struct RichHandler { /* private fields */ }Expand description
Renders log events like upstream’s RichHandler.
Implementations§
Source§impl RichHandler
impl RichHandler
Sourcepub fn new(console: Console) -> Self
pub fn new(console: Console) -> Self
A handler printing to console, with upstream’s defaults: time, level
and path shown, repeated times omitted, ReprHighlighter, no markup,
KEYWORDS highlighted and paths linked.
Sourcepub fn span_view(self, view: SpanView) -> Self
pub fn span_view(self, view: SpanView) -> Self
How an event’s spans are shown (default SpanView::Inline).
Sourcepub fn hyperlinker(self, hyperlinker: Hyperlinker) -> Self
pub fn hyperlinker(self, hyperlinker: Hyperlinker) -> Self
Link the path column through hyperlinker instead of a bare file://
URL: its editor template, base directory for relative paths (as
tracing reports them) and on/off switch apply.
Sourcepub fn live<W: Write + Send + 'static>(
self,
live: Arc<Mutex<LiveCoordinator<W>>>,
) -> Self
pub fn live<W: Write + Send + 'static>( self, live: Arc<Mutex<LiveCoordinator<W>>>, ) -> Self
Print through live, above its regions, so log lines never tear a
live display. Render with a console as wide as live’s target (see
RenderTarget::console); longer lines fold. The coordinator refuses
control codes, so any in a line (a message, field, span or path) are
shown as symbols instead: every line prints.
Sourcepub fn show_level(self, show: bool) -> Self
pub fn show_level(self, show: bool) -> Self
Show the level column (upstream show_level).
Sourcepub fn omit_repeated_times(self, omit: bool) -> Self
pub fn omit_repeated_times(self, omit: bool) -> Self
Blank a time equal to the previous record’s (upstream
omit_repeated_times).
Sourcepub fn level_width(self, width: Option<usize>) -> Self
pub fn level_width(self, width: Option<usize>) -> Self
The level column’s width, or None to fit (upstream log_time_format’s
sibling level_width, fixed at 8 upstream).
Sourcepub fn highlighter(
self,
highlighter: Option<Box<dyn Highlighter + Send + Sync>>,
) -> Self
pub fn highlighter( self, highlighter: Option<Box<dyn Highlighter + Send + Sync>>, ) -> Self
The message highlighter, or None for none (upstream highlighter).
Sourcepub fn keywords<I, S>(self, keywords: I) -> Self
pub fn keywords<I, S>(self, keywords: I) -> Self
Words styled logging.keyword (upstream keywords).
Sourcepub fn enable_link_path(self, enable: bool) -> Self
pub fn enable_link_path(self, enable: bool) -> Self
Link the path column to the source file (upstream enable_link_path).
Sourcepub fn time_format(
self,
format: impl Fn() -> String + Send + Sync + 'static,
) -> Self
pub fn time_format( self, format: impl Fn() -> String + Send + Sync + 'static, ) -> Self
Format the current time for events without a timestamp (upstream
log_time_format).
Sourcepub fn level_text(severity: Severity) -> Text
pub fn level_text(severity: Severity) -> Text
The level column. Port of RichHandler.get_level_text, with Python’s
level names (WARNING, CRITICAL); TRACE uses logging.level.notset.
Sourcepub fn render_message(&self, event: &StructuredEvent) -> Text
pub fn render_message(&self, event: &StructuredEvent) -> Text
The message column. Port of RichHandler.render_message; structured
fields follow the message as key=value.
Sourcepub fn render(&self, event: &StructuredEvent) -> Table
pub fn render(&self, event: &StructuredEvent) -> Table
Lay out one event. Port of RichHandler.render.
Sourcepub fn emit_event(&self, event: &StructuredEvent)
pub fn emit_event(&self, event: &StructuredEvent)
Print one event. Port of RichHandler.emit.
Trait Implementations§
Source§impl EventSink for RichHandler
Available on crate features log or tracing only.
impl EventSink for RichHandler
log or tracing only.