Skip to main content

ClientLogger

Struct ClientLogger 

Source
pub struct ClientLogger<F> { /* private fields */ }
Available on crate feature client only.
Expand description

The ClientHandler that emits one log line per request.

Implementations§

Source§

impl ClientLogger<()>

Source

pub fn new() -> ClientLogger<impl ClientLogFormatter>

Builds a new client logger.

Defaults:

Source§

impl<T> ClientLogger<T>

Source

pub fn with_formatter<Formatter: ClientLogFormatter>( self, formatter: Formatter, ) -> ClientLogger<Formatter>

Replace the formatter with any type that implements ClientLogFormatter.

use trillium_logger::client::{ClientLogger, formatters};
ClientLogger::new().with_formatter((formatters::method, " ", formatters::url));
Source§

impl<F: ClientLogFormatter> ClientLogger<F>

Source

pub fn with_color_mode(self, color_mode: ColorMode) -> Self

Specify the color mode for this logger. See ColorMode for details.

Source

pub fn with_target(self, target: impl Targetable) -> Self

Specify the logger target. See Target and Targetable.

Trait Implementations§

Source§

impl<F: ClientLogFormatter> ClientHandler for ClientLogger<F>

Source§

async fn run(&self, conn: &mut Conn) -> Result<()>

Forward-pass hook, called before the network round-trip in declared order. Read more
Source§

async fn after_response(&self, conn: &mut Conn) -> Result<()>

Reverse-pass hook, called after the network round-trip (or after a halt-skipped network call) in reverse declared order. Always runs regardless of halt status or transport error. Read more
Source§

fn name(&self) -> Cow<'static, str>

Human-readable name for logging/debugging. Defaults to the type name.
Source§

impl<F> Debug for ClientLogger<F>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<F> !RefUnwindSafe for ClientLogger<F>

§

impl<F> !UnwindSafe for ClientLogger<F>

§

impl<F> Freeze for ClientLogger<F>
where F: Freeze,

§

impl<F> Send for ClientLogger<F>
where F: Send,

§

impl<F> Sync for ClientLogger<F>
where F: Sync,

§

impl<F> Unpin for ClientLogger<F>
where F: Unpin,

§

impl<F> UnsafeUnpin for ClientLogger<F>
where F: UnsafeUnpin,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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, U> Into<U> for T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.