Logging Module
logging_config.py
Centralized logging configuration for the DITA SOP converter.
- This module keeps logging setup isolated so that:
library/API code does not implicitly configure logging
CLI tools may override formatter/level as needed
tests can control/log silence if necessary
- dita_sop_converter.logging_config.configure_logging(level=20)
Configure basic application-wide logging behavior.
This function should be invoked by entry points (such as CLI scripts). Internal modules should not call it implicitly in order to avoid surprising global state changes.
- Return type:
None- Parameters:
level (int)
Parameters
- levelint, optional
Logging level constant such as
logging.INFOorlogging.DEBUG. Defaults tologging.INFO.
Notes
Uses
logging.basicConfig()to set a concise formatter.Calling multiple times has no adverse effect because Python ignores subsequent basicConfig calls unless handlers are cleared.
- dita_sop_converter.logging_config.get_logger(name=None)
Return a module-scoped logger.
- Return type:
logging.Logger- Parameters:
name (str | None)
Parameters
- namestr, optional
Fully qualified logger name. If omitted, defaults to this module’s name.
Returns
- logging.Logger
A logger instance that respects the global configuration.
Notes
The returned logger never configures handlers itself.
This prevents accidental duplicate log lines when libraries call
get_logger().