pub struct Pretty;
Expand description

Format logs for pretty printing.

Interpreting span times

Spans have the following format:

<NAME> [ <DURATION> | <BODY> / <ROOT> ]
  • DURATION represents the total time the span was entered for. If the span was used to instrument a Future that sleeps, then that time won’t be counted since the Future won’t be polled during that time, and so the span won’t enter.
  • BODY represents the percent time the span is entered relative to the root span, excluding time that any child spans are entered.
  • ROOT represents the percent time the span is entered relative to the root span, including time that any child spans are entered.

As a mental model, look at ROOT to quickly narrow down which branches are costly, and look at BASE to pinpoint exactly which spans are expensive.

Spans without any child spans would have the same BASE and ROOT, so the redundency is omitted.

Examples

An arbitrarily complex example:

INFO     try_from_entry_ro [ 324µs | 8.47% / 100.00% ]
INFO     ┝━ server::internal_search [ 296µs | 19.02% / 91.53% ]
INFO     │  ┝━ i [filter.info]: Some filter info...
INFO     │  ┝━ server::search [ 226µs | 10.11% / 70.01% ]
INFO     │  │  ┝━ be::search [ 181µs | 6.94% / 55.85% ]
INFO     │  │  │  ┕━ be::search -> filter2idl [ 158µs | 19.65% / 48.91% ]
INFO     │  │  │     ┝━ be::idl_arc_sqlite::get_idl [ 20.4µs | 6.30% ]
INFO     │  │  │     │  ┕━ i [filter.info]: Some filter info...
INFO     │  │  │     ┕━ be::idl_arc_sqlite::get_idl [ 74.3µs | 22.96% ]
ERROR    │  │  │        ┝━ 🚨 [admin.error]: On no, an admin error occurred :(
DEBUG    │  │  │        ┝━ 🐛 [debug]: An untagged debug log
INFO     │  │  │        ┕━ i [admin.info]: there's been a big mistake | alive: false | status: "very sad"
INFO     │  │  ┕━ be::idl_arc_sqlite::get_identry [ 13.1µs | 4.04% ]
ERROR    │  │     ┝━ 🔐 [security.critical]: A security critical log
INFO     │  │     ┕━ 🔓 [security.access]: A security access log
INFO     │  ┕━ server::search<filter_resolve> [ 8.08µs | 2.50% ]
WARN     │     ┕━ 🚧 [filter.warn]: Some filter warning
TRACE    ┕━ 📍 [trace]: Finished!

Trait Implementations§

source§

impl Debug for Pretty

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Formatter for Pretty

§

type Error = Error

The error type if the Tree cannot be stringified.
source§

fn fmt(&self, tree: &Tree) -> Result<String, Error>

Stringifies the Tree, or returns an error. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more