/usr/lib/python3/dist-packages/twisted/logger
NameSizeModeActions
test/-0755rm
__pycache__/-0755rm
_buffer.py15290644editdlrm
_capture.py6240644editdlrm
_file.py23370644editdlrm
_filter.py68950644editdlrm
_flatten.py49960644editdlrm
_format.py118740644editdlrm
_global.py86380644editdlrm
_interfaces.py23480644editdlrm
_io.py45680644editdlrm
_json.py84330644editdlrm
_legacy.py52410644editdlrm
_levels.py29850644editdlrm
_logger.py99820644editdlrm
_observer.py32410644editdlrm
_stdlib.py45460644editdlrm
_util.py14000644editdlrm
__init__.py33690644editdlrm
Edit: /usr/lib/python3/dist-packages/twisted/logger/_util.py (1400B)
# -*- test-case-name: twisted.logger.test.test_util -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Logging utilities. """ from typing import List from ._interfaces import LogTrace from ._logger import Logger def formatTrace(trace: LogTrace) -> str: """ Format a trace (that is, the contents of the C{log_trace} key of a log event) as a visual indication of the message's propagation through various observers. @param trace: the contents of the C{log_trace} key from an event. @return: A multi-line string with indentation and arrows indicating the flow of the message through various observers. """ def formatWithName(obj: object) -> str: if hasattr(obj, "name"): return f"{obj} ({obj.name})" # type: ignore[attr-defined] else: return f"{obj}" result = [] lineage: List[Logger] = [] for parent, child in trace: if not lineage or lineage[-1] is not parent: if parent in lineage: while lineage[-1] is not parent: lineage.pop() else: if not lineage: result.append(f"{formatWithName(parent)}\n") lineage.append(parent) result.append(" " * len(lineage)) result.append(f"-> {formatWithName(child)}\n") return "".join(result)