clabe.logging ¶
add_file_handler ¶
add_file_handler(
logger: TLogger, output_path: PathLike
) -> TLogger
Adds a file handler to the logger to write logs to a file.
Creates a new file handler with UTC timezone formatting and adds it to the specified logger for persistent log storage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logger
|
TLogger
|
The logger to which the file handler will be added |
required |
output_path
|
PathLike
|
The path to the log file |
required |
Returns:
| Name | Type | Description |
|---|---|---|
TLogger |
TLogger
|
The logger with the added file handler |
Source code in src/clabe/logging/_stdlib.py
close_file_handlers ¶
Closes all file handlers associated with the logger.
Iterates through all handlers associated with the logger and closes any file handlers to ensure proper resource cleanup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logger
|
TLogger
|
The logger whose file handlers will be closed |
required |
Returns:
| Name | Type | Description |
|---|---|---|
TLogger |
TLogger
|
The logger with closed file handlers |
Source code in src/clabe/logging/_stdlib.py
configure_console_logging ¶
Installs clabe's default root-logger configuration (console handler, format, level).
set_console_level ¶
set_console_level(level: int) -> None
Sets the verbosity threshold of the interactive console log handler.
This only affects what is shown to the user on the console; it is fully
decoupled from what is written to the log file (see add_file_handler)
and from any remote handlers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
int
|
A standard |
required |
Source code in src/clabe/logging/_stdlib.py
shutdown_logger ¶
Shuts down the logger by closing all file handlers and calling logging.shutdown().
Performs a complete shutdown of the logging system, ensuring all file handlers are properly closed and resources are released.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logger
|
TLogger
|
The logger to shut down |
required |
Returns:
| Name | Type | Description |
|---|---|---|
TLogger |
TLogger
|
The logger with closed file handlers |