robokudo.utils.logging_configuration¶
Logging configuration utilities for Robokudo.
This module provides functionality for configuring Python logging in a ROS environment. It handles:
Logger configuration from YAML files
ROS-Python logging integration
Custom log formatting
Per-module log level control
Note
ROS normally disables Python’s default logging system. This module provides a workaround to enable proper Python logging alongside ROS logging.
Classes¶
Extended logging.Formatter that supports dynamic truncation of filenames. |
Functions¶
|
Configure Python logging system with ROS integration. |
Module Contents¶
- class robokudo.utils.logging_configuration.DynamicCompactFormatter(fmt: str = None, datefmt: str = None, style: str = '%')¶
-
Bases:
logging.FormatterExtended logging.Formatter that supports dynamic truncation of filenames.
- _parse_field_width() None¶
-
Parse format string to find filename_line width.
- format(record: logging.LogRecord) str¶
-
Format the given log record according to the formatter’s format string.
- Parameters:
-
record – Log record to format
- Returns:
-
Formatted log message as a string
- robokudo.utils.logging_configuration.configure_logging(logging_config_file_name: str) None¶
-
Configure Python logging system with ROS integration.
Sets up Python logging with:
Console output to stdout
Custom formatter for detailed log messages
Per-module log levels from YAML config
ROS logging integration
The YAML config file should map logger names to logging levels:
logger_name1: INFO logger_name2: DEBUG ...
- Parameters:
-
logging_config_file_name – Path to YAML config file
- Raises:
-
FileNotFoundError – If config file not found
yaml.YAMLError – If config file has invalid format
Note
This is needed because ROS disables standard Python logging. See: https://github.com/ros/ros_comm/issues/1384