savant_rs.py.log
Logging utils package.
Logging setup utils.
- savant_rs.py.log.log_setup.apply_log_spec(log_spec_dict: dict)
Apply log specification.
- Parameters:
log_spec_dict – A dictionary of the form log_target:log_level.
- savant_rs.py.log.log_setup.get_logger(name: str) Logger
Get logger with specified name appended to the general Savant logging prefix.
- Parameters:
name – Logger name.
- Returns:
Logger instance.
- savant_rs.py.log.log_setup.init_logging(log_spec_str: str | None = None)
Initialize logging with specified log level or set default.
- Parameters:
log_spec_str – A comma-separated list of logging directives of the form target=level.
- savant_rs.py.log.log_setup.update_logging(log_spec_str: str)
Update logging with specified log spec.
- Parameters:
log_spec_str – A comma-separated list of logging directives of the form target=level.
General logging utils.
- savant_rs.py.log.log_utils.add_logging_level(level_name, level_num, method_name=None, *, exc_info=False, stack_info=False)
Comprehensively adds a new logging level to the logging module and the currently configured logging class.
Based on https://haggis.readthedocs.io/en/stable/api.html#haggis.logs.add_logging_level
- savant_rs.py.log.log_utils.get_default_log_spec() dict
Get default logging specification.
- savant_rs.py.log.log_utils.get_log_conf(log_spec_dict: dict) dict
Create logging configuration for use in logging.config.dictConfig().
- Parameters:
log_spec_dict – A dictionary of the form log_target:log_level.
- Returns:
Logging configuration dictionary.
- savant_rs.py.log.log_utils.parse_log_spec(log_spec_str: str) dict
Parse logging specification string.
- Parameters:
log_spec_str – A comma-separated list of logging directives of the form target=level.
- Returns:
A dictionary of the form log_target:log_level.
- savant_rs.py.log.log_utils.set_savant_rs_loglevel(log_spec_dict: dict)
Set savant_rs base logging level. No messages with priority lower than this setting are going to be logged.
- Parameters:
log_spec_dict – A dictionary of the form log_target:log_level.
LoggerMixin module.
- class savant_rs.py.log.logger_mixin.LoggerMixin
Mixes logger in GStreamer element.
When the element name is available, logger name changes to module_name/element_name. Otherwise, logger name is module_name.
Note: we cannot override do_set_state or any other method where element name becomes available since base classes are bindings.
- property logger
Logger.
SavantRsLoggingHandler module.
- class savant_rs.py.log.savant_rs_handler.SavantRsLoggingHandler
Custom logging Handler that passes the log messages to the rust log from savant_rs with appropriate log level.
No need to specify formatter during logging configuration:
for all messages under ERROR priority no formatting is performed (rely on underlying rust log formatter)
pretty_traceback formatter for ERROR and CRITICAL messages
- emit(record: LogRecord)
Emit a record.
- format(record: LogRecord) str
Format a record.