preheat_open.configuration.LoggingConfig
- class preheat_open.configuration.LoggingConfig
Bases:
ConfigBaseLogging configuration settings.
Controls the application’s logging behavior.
- Attributes:
level (int): The logging level (corresponds to standard logging levels) format (str): The format string for log messages auto_setup (bool): Whether to automatically set up logging on initialization directory (str): Path to the log directory library_name (str): Name of the library for logger namespace runtime_mode (int): The current runtime mode
- __init__()
Initialize configuration from environment variables.
Methods
__init__()Initialize configuration from environment variables.
Iterate over all attributes of the configuration object.
pretty_print([anonymize])Create a string representation with sensitive fields masked.
Set up logging based on the configuration.
Return a context manager that temporarily sets environment variables.
Attributes
auto_setupdirectoryformatlevelruntime_modeGet a proxy object to update configuration attributes and environment variables.
- class TempContext(config_obj)
Bases:
Generic[T]Context manager for temporarily setting environment variables.
- iter_items()
Iterate over all attributes of the configuration object.
- Return type:
Generator[tuple[str,Any],None,None]
- Yields:
tuple[str, Any]: A tuple of attribute name and value
- pretty_print(anonymize=None)
Create a string representation with sensitive fields masked.
- Return type:
str
- Returns:
str: String representation of the configuration
- setup_logging()
Set up logging based on the configuration.
- Return type:
None
- temporary()
Return a context manager that temporarily sets environment variables.
- Return type:
TempContext[T]
- Usage:
- with config.temporary():
# Environment variables reflect config values here
# Original environment variables restored here
- Returns:
TempContext: A context manager that preserves the specific config type
- property update: UpdateProxy
Get a proxy object to update configuration attributes and environment variables.