Logging
Configuration
Configuration of logging is done via a configuration file. The default configuration file is config/config_logging.conf and can be substituted by setting settings.logging.configfile, e.g.
[logging]
configfile = "./shobnetpy/config/config_logging_user.conf"
Per default, above WARN-Level will be logged to the console, and above INFO-Level will be logged to a file at <output_path>/logs/shobnetpy<Run-ID>.log.
To adjust loglevels for specific subpackages or module add a section to your custom configuration file like:
[logger_shobnetpy_geo]
level=DEBUG
handlers=
qualname=shobnetpy.geo
propagate=1
More information can be obtained from the Logging Cookbook.
Implementation
AHID uses the python logging framework. Configuration code is placed in util/logging.py and called in config/config.py with the advantage that no additional import is required in modules. All we need in modules is the logger obtained by
logger = logging.getLogger('shobnetpy.subpackage.module')
Log messages are triggered by
logger.info("Information for the user")
logger.debug("Information that helps to debug code")