Types and Enums¶
Type definitions and enumerations.
LogLevel¶
Log level enumeration with colors and styles.
LogLevel
¶
Bases: Enum
LogLevel is an enumeration representing different logging levels with associated names, numeric levels, and colorimetric configurations.
Attributes:
* label: Human-readable name of the log level
* no: Numeric level for comparison
* fg: Foreground color code
* bg: Background color code
Levels:
* DEBUG: Debugging messages (lowest priority)
* INFO: Informational messages
* SUCCESS: Success messages
* WARNING: Warning messages
* ERROR: Error messages
* CRITICAL: Critical messages (highest priority)
Initialize a LogLevel instance.
| PARAMETER | DESCRIPTION |
|---|---|
label
|
Human-readable name of the log level
TYPE:
|
no
|
Numeric level for comparison
TYPE:
|
fg
|
Foreground color code
TYPE:
|
bg
|
Background color code
TYPE:
|
Source code in src/ezpl/types/enums/log_level.py
get_attribute
classmethod
¶
Returns the specified attribute (label, no, fg, bg) for a given logging level.
| PARAMETER | DESCRIPTION |
|---|---|
level
|
The logging level name
TYPE:
|
attribute
|
The attribute to retrieve ('label', 'no', 'fg', 'bg')
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Any
|
The requested attribute value |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the level or attribute is not found |
Source code in src/ezpl/types/enums/log_level.py
get_label
classmethod
¶
Get the label for a given log level.
| PARAMETER | DESCRIPTION |
|---|---|
level
|
The logging level name
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The label for the log level |
Source code in src/ezpl/types/enums/log_level.py
get_no
classmethod
¶
Get the numeric level for a given log level.
| PARAMETER | DESCRIPTION |
|---|---|
level
|
The logging level name
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
The numeric level |
Source code in src/ezpl/types/enums/log_level.py
get_fgcolor
classmethod
¶
Get the foreground color for a given log level.
| PARAMETER | DESCRIPTION |
|---|---|
level
|
The logging level name
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The foreground color code |
Source code in src/ezpl/types/enums/log_level.py
get_bgcolor
classmethod
¶
Get the background color for a given log level.
| PARAMETER | DESCRIPTION |
|---|---|
level
|
The logging level name
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The background color code |
Source code in src/ezpl/types/enums/log_level.py
is_valid_level
classmethod
¶
Check if a given level is valid.
| PARAMETER | DESCRIPTION |
|---|---|
level
|
The logging level name to check
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the level is valid, False otherwise |
Source code in src/ezpl/types/enums/log_level.py
get_all_levels
classmethod
¶
Get all available log levels.
| RETURNS | DESCRIPTION |
|---|---|
list[str]
|
List of all available log level names |
get_rich_style
¶
Get the Rich style string for this log level.
| RETURNS | DESCRIPTION |
|---|---|
str
|
Rich style string (e.g., "bold red", "cyan", etc.) |
Source code in src/ezpl/types/enums/log_level.py
Pattern¶
Contextual pattern enumeration.
Pattern
¶
Bases: Enum
Contextual patterns for console output.
Patterns provide semantic meaning beyond log levels, allowing for more expressive and contextual logging.
Pattern Colors¶
Pattern color mapping utilities.
get_pattern_color
¶
get_pattern_color(pattern: Pattern) -> str
Get the Rich color style for a pattern.
| PARAMETER | DESCRIPTION |
|---|---|
pattern
|
The pattern to get the color for
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Rich color style string |
get_pattern_color_by_name
¶
Get the Rich color style for a pattern by name.
| PARAMETER | DESCRIPTION |
|---|---|
pattern_name
|
The pattern name (case-insensitive)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Rich color style string |
PATTERN_COLORS
module-attribute
¶
PATTERN_COLORS: dict[Pattern, str] = {SUCCESS: 'bright_green', ERROR: 'bright_red', WARN: 'bright_yellow', TIP: 'bright_magenta', DEBUG: 'dim white', INFO: 'bright_blue', SYSTEM: 'bright_blue', INSTALL: 'bright_green', DETECT: 'bright_blue', CONFIG: 'bright_green', DEPS: 'bright_cyan'}