Runtime Config
app.shared.runtime_configModule for runtime config; provides reusable helpers across application layers.
See Also
configure_logging— applies validated log-level configuration
Layer: Shared utilities. Context: Provides reusable helpers across application layers at this architectural boundary.
DEFAULT_LOG_CONSOLE_LEVEL = 'DEBUG'
module-attribute
DEFAULT_LOG_FILE_LEVEL = 'TRACE'
module-attribute
DEFAULT_LOG_FILE_PATH = 'logs/app.log'
module-attribute
ENV_LOG_CONSOLE_LEVEL = 'BLURZY_LOG_CONSOLE_LEVEL'
module-attribute
ENV_LOG_FILE_LEVEL = 'BLURZY_LOG_FILE_LEVEL'
module-attribute
ENV_LOG_FILE_PATH = 'BLURZY_LOG_FILE_PATH'
module-attribute
ENV_LOG_ENABLED_AREAS = 'BLURZY_LOG_ENABLED_AREAS'
module-attribute
VALID_LOG_LEVELS = frozenset({'TRACE', 'DEBUG', 'INFO', 'SUCCESS', 'WARNING', 'ERROR', 'CRITICAL'})
module-attribute
StartupConfigurationError
Bases: ValueError
Raised when startup configuration cannot be validated safely.
Layer: Shared utilities. Context: Provides reusable cross-layer behavior without owning workflow state.
StartupConfig
dataclass
Represent startup config.
| ATTRIBUTE | DESCRIPTION |
|---|---|
console_level |
Stored console level value.
TYPE:
|
file_level |
Stored file level value.
TYPE:
|
log_file_path |
Stored log file path value.
TYPE:
|
enabled_areas |
Stored enabled areas value.
TYPE:
|
Layer: Shared utilities. Context: Provides reusable cross-layer behavior without owning workflow state.
console_level: str = DEFAULT_LOG_CONSOLE_LEVEL
class-attribute
instance-attribute
enabled_areas: tuple[str, ...] | None = None
class-attribute
instance-attribute
file_level: str = DEFAULT_LOG_FILE_LEVEL
class-attribute
instance-attribute
log_file_path: str = DEFAULT_LOG_FILE_PATH
class-attribute
instance-attribute
__init__(console_level: str = DEFAULT_LOG_CONSOLE_LEVEL, file_level: str = DEFAULT_LOG_FILE_LEVEL, log_file_path: str = DEFAULT_LOG_FILE_PATH, enabled_areas: tuple[str, ...] | None = None) -> None
enabled_areas_for_logging() -> set[str] | None
Return the application areas enabled for logging.
| RETURNS | DESCRIPTION |
|---|---|
set[str] | None
|
A mutable set copied from the configured tuple, or |
from_env(env: Mapping[str, str] | None = None) -> 'StartupConfig'
classmethod
Build startup configuration from environment variables.
| PARAMETER | DESCRIPTION |
|---|---|
env
|
Environment mapping to read, or the process environment when omitted.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
'StartupConfig'
|
Configuration with normalized log levels, validated file path, and parsed area filter. |
normalize_log_level(value: str, *, env_var: str) -> str
Normalize log level.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Log-level name to normalize and validate.
TYPE:
|
env_var
|
Environment-variable name used in validation errors.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The normalized uppercase log-level name. |
validate_log_file_path(value: str, *, env_var: str) -> str
Validate log file path.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Path string to validate.
TYPE:
|
env_var
|
Environment-variable name used in validation errors.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The trimmed path string. |
parse_enabled_areas(value: str | None) -> tuple[str, ...] | None
Parse a comma-separated allow-list into a stable deduplicated tuple.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Comma-separated logging-area names, or
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[str, ...] | None
|
Deduplicated area names, or |