pub struct Logger { /* private fields */ }
Expand description
Logger can be passed in as the first argument into one of the logging
macros provided by rclrs. When passing it into one of the logging macros,
you can optionally apply any of the methods from ToLogParams
to tweak
the logging behavior.
You can obtain a Logger in the following ways:
- Calling
Node::logger
to get the logger of a Node - Using
Logger::create_child
to create a child logger for an existing logger - Using
Logger::new
to create a new logger with any name that you’d like - Using
Logger::default()
to access the global default logger
Note that if you are passing the Logger of a Node into one of the logging macros,
then you can choose to simply pass in &node
instead of node.logger()
.
Implementations§
Source§impl Logger
impl Logger
Sourcepub fn new(name: impl Borrow<str>) -> Result<Logger, RclrsError>
pub fn new(name: impl Borrow<str>) -> Result<Logger, RclrsError>
Create a new logger with the given name.
Sourcepub fn create_child(
&self,
child_name: impl Borrow<str>,
) -> Result<Logger, RclrsError>
pub fn create_child( &self, child_name: impl Borrow<str>, ) -> Result<Logger, RclrsError>
Create a new logger which will be a child of this logger.
If the name of this logger is parent_name
, then the name for the new
child will be ’“parent_name.child_name”`.
If this is the default logger (whose name is an empty string), then the
name for the new child will simply be the value in child_name
.
Sourcepub fn set_level(&self, severity: LogSeverity) -> Result<(), RclrsError>
pub fn set_level(&self, severity: LogSeverity) -> Result<(), RclrsError>
Set the severity level of this logger
Sourcepub fn set_default_level(severity: LogSeverity)
pub fn set_default_level(severity: LogSeverity)
Set the severity level of the default logger which acts as the root ancestor of all other loggers.
Trait Implementations§
Source§impl Ord for Logger
impl Ord for Logger
Source§impl PartialOrd for Logger
impl PartialOrd for Logger
Source§impl<'a> ToLogParams<'a> for &'a Logger
impl<'a> ToLogParams<'a> for &'a Logger
Source§fn to_log_params(self) -> LogParams<'a>
fn to_log_params(self) -> LogParams<'a>
Source§fn skip_first(self) -> LogParams<'a>
fn skip_first(self) -> LogParams<'a>
Source§fn occurs(self, occurs: LogOccurrence) -> LogParams<'a>
fn occurs(self, occurs: LogOccurrence) -> LogParams<'a>
Source§fn throttle(self, throttle: Duration) -> LogParams<'a>
fn throttle(self, throttle: Duration) -> LogParams<'a>
Source§fn throttle_clock(self, clock: ThrottleClock<'a>) -> LogParams<'a>
fn throttle_clock(self, clock: ThrottleClock<'a>) -> LogParams<'a>
Source§fn only_if(self, only_if: bool) -> LogParams<'a>
fn only_if(self, only_if: bool) -> LogParams<'a>
false
expression is passed into
this function. Read more