Logging
matchbox.common.logging
¶
Logging utilities.
Classes:
-
PrefixedLoggerAdapter
–A logger adapter that supports adding a prefix enclosed in square brackets.
-
ASIMFormatter
–Format logging with ASIM standard fields.
Functions:
-
build_progress_bar
–Create a progress bar.
Attributes:
-
LogLevelType
–Type for all Python log levels.
-
logger
(Final[PrefixedLoggerAdapter]
) –Logger for Matchbox.
-
console
(Final[Console]
) –Console for Matchbox.
LogLevelType
module-attribute
¶
LogLevelType = Literal[
"DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"
]
Type for all Python log levels.
logger
module-attribute
¶
logger: Final[PrefixedLoggerAdapter] = (
PrefixedLoggerAdapter(getLogger("matchbox"), {})
)
Logger for Matchbox.
Used for all logging in the Matchbox library.
Allows passing a prefix to any logging call.
Examples:
console
module-attribute
¶
console: Final[Console] = Console()
Console for Matchbox.
Used for any CLI utilities in the Matchbox library.
PrefixedLoggerAdapter
¶
Bases: LoggerAdapter
A logger adapter that supports adding a prefix enclosed in square brackets.
This adapter allows passing an optional prefix parameter to any logging call without modifying the underlying logger.
Methods:
-
process
–Process the log message, adding a prefix if provided.
process
¶
ASIMFormatter
¶
Bases: Formatter
Format logging with ASIM standard fields.
Methods:
-
format
–Convert logs to JSON.
Attributes:
-
matchbox_version
(str
) –Cached matchbox version.
-
event_severity
(dict[str, str]
) –Event severity level lookup.
build_progress_bar
¶
Create a progress bar.