optigob.logger ============== .. py:module:: optigob.logger .. autoapi-nested-parse:: logger ====== This module provides a simple logging interface for optigob. All logging in optigob uses Python's standard logging module, which allows users to control what messages they see and where they go (console, file, etc.). Functions: get_logger: Get a logger instance for a specific optigob module. configure_logging: Quick setup function for common logging configurations. .. rubric:: Example >>> from optigob.logger import get_logger >>> logger = get_logger("my_module") >>> logger.info("This is an informational message") >>> logger.warning("This is a warning") Functions --------- .. autoapisummary:: optigob.logger.get_logger optigob.logger.configure_logging Module Contents --------------- .. py:function:: get_logger(name=None) Get a logger instance for optigob. This function returns a logger that is part of the 'optigob' logging hierarchy. All optigob loggers can be controlled together by configuring the root 'optigob' logger. :param name: Name of the module/component requesting the logger. If provided, logger will be named "optigob.{name}". If None, returns the root "optigob" logger. :type name: str, optional :returns: A logger instance that can be used to log messages. :rtype: logging.Logger .. rubric:: Example >>> logger = get_logger("data_manager") >>> logger.info("Loading data...") >>> logger.warning("Parameter validation issue detected") .. note:: By default, if no configuration has been done, Python's logging will only show WARNING level and above. Call configure_logging() to see INFO and DEBUG. .. py:function:: configure_logging(level=logging.INFO, log_to_file=None, format_style='detailed') Configure logging for optigob with sensible defaults. This is a convenience function for common logging setups. Users can call this at the start of their script to control what optigob logs. :param level: Minimum logging level to display. Options: - logging.DEBUG (most verbose - shows everything) - logging.INFO (normal - shows general info) - logging.WARNING (quiet - only warnings and errors) - logging.ERROR (very quiet - only errors) Default: logging.INFO :type level: int :param log_to_file: If provided, logs will be written to this file in addition to the console. If None, logs only go to console. Default: None :type log_to_file: str, optional :param format_style: How detailed the log messages should be. Options: - "simple": Just the message - "detailed": Time, module name, level, and message Default: "detailed" :type format_style: str :returns: None .. rubric:: Example >>> # Show all INFO and above messages >>> configure_logging(level=logging.INFO) >>> # Only show warnings and errors >>> configure_logging(level=logging.WARNING) >>> # Log everything to a file >>> configure_logging(level=logging.DEBUG, log_to_file="optigob.log") .. note:: This function configures the root 'optigob' logger. If you need more advanced control, use Python's logging module directly.