rclpy.impl.rcutils_logger module
- class rclpy.impl.rcutils_logger.CallerId(frame=None)
Bases:
CallerId
Create new instance of CallerId(function_name, file_path, line_number, last_index)
- class rclpy.impl.rcutils_logger.LoggingFilter
Bases:
object
Base class for logging filters.
- classmethod initialize_context(context, **kwargs)
- params = {}
Initialize the context of a logging call, e.g. declare variables needed for determining the log condition and add them to the context.
- static should_log(context)
- class rclpy.impl.rcutils_logger.Once
Bases:
LoggingFilter
Ignore all log calls except the first one.
- classmethod initialize_context(context, **kwargs)
- params = {'once': None}
Initialize the context of a logging call, e.g. declare variables needed for determining the log condition and add them to the context.
- static should_log(context)
- class rclpy.impl.rcutils_logger.RcutilsLogger(name='')
Bases:
object
- debug(message, **kwargs)
Log a message with DEBUG severity via :py:classmethod:RcutilsLogger.log:.
- error(message, **kwargs)
Log a message with ERROR severity via :py:classmethod:RcutilsLogger.log:.
- fatal(message, **kwargs)
Log a message with FATAL severity via :py:classmethod:RcutilsLogger.log:.
- get_child(name)
- get_effective_level()
- info(message, **kwargs)
Log a message with INFO severity via :py:classmethod:RcutilsLogger.log:.
- is_enabled_for(severity)
- log(message, severity, **kwargs)
Log a message with the specified severity.
- The message will not be logged if:
the logger is not enabled for the message’s severity (the message severity is less than the level of the logger), or
a logging filter causes the message to be skipped.
Note
Logging filters will only be evaluated if the logger is enabled for the message’s severity.
- Parameters:
str (name) – message to log.
severity (:py:class:LoggingSeverity) – severity of the message.
str – name of the logger to use.
**kwargs – optional parameters for logging filters (see below).
- Keyword Arguments:
throttle_duration_sec (
float
) – Duration of the throttle interval for the :py:class:Throttle: filter.throttle_time_source_type (
str
) – Optional time source type for the :py:class:Throttle: filter (default ofRCUTILS_STEADY_TIME
)skip_first (
bool
) – If True, enable the :py:class:SkipFirst: filter.once (
bool
) – If True, enable the :py:class:Once: filter.
- Returns:
False if a filter caused the message to not be logged; True otherwise.
- Raises:
TypeError on invalid filter parameter combinations.
- Raises:
ValueError on invalid parameters values.
- Return type:
bool
- set_level(level)
- warn(message, **kwargs)
Log a message with WARN severity via :py:classmethod:RcutilsLogger.log:.
Deprecated in favor of :py:classmethod:RcutilsLogger.warning:.
- warning(message, **kwargs)
Log a message with WARN severity via :py:classmethod:RcutilsLogger.log:.
- class rclpy.impl.rcutils_logger.SkipFirst
Bases:
LoggingFilter
Ignore the first log call but process all subsequent calls.
- classmethod initialize_context(context, **kwargs)
- params = {'skip_first': None}
Initialize the context of a logging call, e.g. declare variables needed for determining the log condition and add them to the context.
- static should_log(context)
- class rclpy.impl.rcutils_logger.Throttle
Bases:
LoggingFilter
Ignore log calls if the last call is not longer ago than the specified duration.
- classmethod initialize_context(context, **kwargs)
- params = {'throttle_duration_sec': None, 'throttle_time_source_type': rclpy.clock.Clock}
Initialize the context of a logging call, e.g. declare variables needed for determining the log condition and add them to the context.
- static should_log(context)
- rclpy.impl.rcutils_logger.get_filters_from_kwargs(**kwargs)
Determine which filters have had parameters specified in the given keyword arguments.
Returns the list of filters using the order specified by supported_filters.