gedih3.logging_config#

Logging configuration for gedih3 package.

Provides a consistent logging interface across all modules and CLI tools. Uses Python’s standard logging module with configurable levels and handlers.

Usage:

from gedih3.logging_config import get_logger logger = get_logger(__name__) logger.info(“Processing started”) logger.debug(“Detailed information”) logger.warning(“Something unexpected”) logger.error(“An error occurred”)

Attributes#

Classes#

LoggingContext

Context manager for temporarily changing log level.

Functions#

configure_logging(→ logging.Logger)

Configure the gedih3 logging system.

get_logger(→ logging.Logger)

Get a logger for the specified module.

set_level(→ None)

Change the logging level for all gedih3 loggers.

silence(→ None)

Silence all gedih3 logging output.

enable_debug(→ None)

Enable debug-level logging.

Module Contents#

gedih3.logging_config.CONSOLE_FORMAT = '%(message)s'#
gedih3.logging_config.CONSOLE_FORMAT_VERBOSE = '%(asctime)s [%(levelname)s] %(name)s: %(message)s'#
gedih3.logging_config.FILE_FORMAT = '%(asctime)s [%(levelname)s] %(name)s (%(filename)s:%(lineno)d): %(message)s'#
gedih3.logging_config.DATE_FORMAT = '%Y-%m-%d %H:%M:%S'#
gedih3.logging_config.ROOT_LOGGER_NAME = 'gedih3'#
gedih3.logging_config.configure_logging(level: int = logging.INFO, verbose: bool = False, log_file: str | None = None, quiet: bool = False) logging.Logger[source]#

Configure the gedih3 logging system.

Parameters:
levelint

Logging level (logging.DEBUG, logging.INFO, logging.WARNING, etc.)

verbosebool

If True, use verbose format with timestamps and module names

log_filestr, optional

Path to log file. If provided, logs will also be written to this file.

quietbool

If True, suppress console output (file logging still works if configured)

Returns:
logging.Logger

The configured root logger for gedih3

Examples

>>> from gedih3.logging_config import configure_logging
>>> configure_logging(level=logging.DEBUG, verbose=True)
>>> configure_logging(log_file="/tmp/gedih3.log")
>>> configure_logging(quiet=True)  # Suppress console output
gedih3.logging_config.get_logger(name: str | None = None) logging.Logger[source]#

Get a logger for the specified module.

Parameters:
namestr, optional

Module name (typically __name__). If None, returns the root gedih3 logger.

Returns:
logging.Logger

Logger instance for the module

Examples

>>> from gedih3.logging_config import get_logger
>>> logger = get_logger(__name__)
>>> logger.info("Processing started")
gedih3.logging_config.set_level(level: int) None[source]#

Change the logging level for all gedih3 loggers.

Parameters:
levelint

New logging level (logging.DEBUG, logging.INFO, etc.)

gedih3.logging_config.silence() None[source]#

Silence all gedih3 logging output.

gedih3.logging_config.enable_debug() None[source]#

Enable debug-level logging.

class gedih3.logging_config.LoggingContext(level: int)[source]#

Context manager for temporarily changing log level.

Examples

>>> with LoggingContext(logging.DEBUG):
...     # Debug logging enabled here
...     pass
>>> # Original log level restored
level#
logger#
old_level = None#
__enter__()[source]#
__exit__(exc_type, exc_val, exc_tb)[source]#