rclrs

Trait ToLogParams

Source
pub trait ToLogParams<'a>: Sized {
Show 13 methods // Required method fn to_log_params(self) -> LogParams<'a>; // Provided methods fn once(self) -> LogParams<'a> { ... } fn skip_first(self) -> LogParams<'a> { ... } fn occurs(self, occurs: LogOccurrence) -> LogParams<'a> { ... } fn throttle(self, throttle: Duration) -> LogParams<'a> { ... } fn throttle_clock(self, clock: ThrottleClock<'a>) -> LogParams<'a> { ... } fn only_if(self, only_if: bool) -> LogParams<'a> { ... } fn debug(self) -> LogParams<'a> { ... } fn info(self) -> LogParams<'a> { ... } fn warn(self) -> LogParams<'a> { ... } fn error(self) -> LogParams<'a> { ... } fn fatal(self) -> LogParams<'a> { ... } fn severity(self, severity: LogSeverity) -> LogParams<'a> { ... }
}
Expand description

Methods for defining the behavior of a logging instance.

This trait is implemented by Logger, Node, and anything that a &str can be borrowed from, such as string literals ("my_str"), String, or Cow<str>.

Required Methods§

Source

fn to_log_params(self) -> LogParams<'a>

Convert the object into LogParams with default settings

Provided Methods§

Source

fn once(self) -> LogParams<'a>

The logging should only happen once

Source

fn skip_first(self) -> LogParams<'a>

The first time the logging happens, we should skip it

Source

fn occurs(self, occurs: LogOccurrence) -> LogParams<'a>

Set the occurrence behavior of the log instance

Source

fn throttle(self, throttle: Duration) -> LogParams<'a>

Set a throttling interval during which this log will not publish. A value of zero will never block the message from being published, and this is the default behavior.

A negative duration is not valid, but will be treated as a zero duration.

Source

fn throttle_clock(self, clock: ThrottleClock<'a>) -> LogParams<'a>

Set the clock that will be used to control throttling.

Source

fn only_if(self, only_if: bool) -> LogParams<'a>

The log will not be published if a false expression is passed into this function.

Other factors may prevent the log from being published if a true is passed in, such as ToLogParams::throttle or ToLogParams::once filtering the log.

Source

fn debug(self) -> LogParams<'a>

Log as a debug message.

Source

fn info(self) -> LogParams<'a>

Log as an informative message. This is the default, so you don’t generally need to use this.

Source

fn warn(self) -> LogParams<'a>

Log as a warning message.

Source

fn error(self) -> LogParams<'a>

Log as an error message.

Source

fn fatal(self) -> LogParams<'a>

Log as a fatal message.

Source

fn severity(self, severity: LogSeverity) -> LogParams<'a>

Set the severity for this instance of logging. The default value will be [LogSeverity::Info].

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a> ToLogParams<'a> for &'a str

Source§

impl<'a, T: Borrow<str>> ToLogParams<'a> for &'a T

Implementors§

Source§

impl<'a> ToLogParams<'a> for &'a Logger

Source§

impl<'a> ToLogParams<'a> for &'a Node

Source§

impl<'a> ToLogParams<'a> for LogParams<'a>