f_lib.logging.utils module¶
Logging utilities.
- f_lib.logging.utils.is_stream_handler(handler: logging.Handler, streams: Iterable[TextIO] | None = None) bool[source]¶
Whether a stream handlers writing to the given streams(s).
- Parameters:
handler – The
logging.Handlerto check.streams – An array of streams to match against.
- f_lib.logging.utils.find_handler(logger: LoggerTypeVar, match_handler: Callable[[logging.Handler], bool] = is_stream_handler) tuple[logging.Handler, LoggerTypeVar] | tuple[None, None][source]¶
Find
logging.Handler`(s) in the propagation tree of a :class:`~logging.Logger.This function finds a
logging.Handlerattached to a logger or one of it’s parents (seewalk_propagation_tree()).- Parameters:
- Returns:
- Return type:
A tuple of two values
- f_lib.logging.utils.optionally_replace_handler(logger: LoggerTypeVar, *, match_handler: Callable[[logging.Handler], bool] = is_stream_handler, reconfigure: bool = False) tuple[logging.Handler | None, LoggerTypeVar][source]¶
Prepare to replace a handler if needed and configured to do so.
- Parameters:
- Returns:
- Return type:
A tuple of two values