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#
Context manager for temporarily changing log level. |
Functions#
|
Configure the gedih3 logging system. |
|
Get a logger for the specified module. |
|
Change the logging level for all gedih3 loggers. |
|
Silence all gedih3 logging output. |
|
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.)