Skip to content

pudl_diff.logs

Logging for the diff tool, using only the standard library.

LOGGER_NAME = 'pudl_diff' module-attribute

The parent of the loggers of all this tool's modules, so that an application using the tool can configure its logging in one place.

get_logger(module_name)

The logger for a module, named pudl_diff.<module>.

Parameters:

Name Type Description Default
module_name str

The module's __name__. Only its last component is used, so that the loggers' names don't depend on where the tool is installed.

required
Source code in src/pudl_diff/logs.py
def get_logger(module_name: str) -> logging.Logger:
    """The logger for a module, named `pudl_diff.<module>`.

    Args:
        module_name: The module's `__name__`. Only its last component is used, so
            that the loggers' names don't depend on where the tool is installed.
    """
    return logging.getLogger(f"{LOGGER_NAME}.{module_name.rpartition('.')[2]}")