Skip to content

liblaf.grapes.rich.logging ¤

Modules:

Classes:

RichHandler ¤

RichHandler(
    console: Console | None = None,
    *,
    columns: Iterable[RichHandlerColumn] | None = None,
    level: int = NOTSET,
)

Bases: Handler


              flowchart TD
              liblaf.grapes.rich.logging.RichHandler[RichHandler]

              

              click liblaf.grapes.rich.logging.RichHandler href "" "liblaf.grapes.rich.logging.RichHandler"
            

Methods:

Attributes:

Source code in src/liblaf/grapes/rich/logging/handlers/_handler.py
34
35
36
37
38
39
40
41
42
43
44
45
46
47
def __init__(
    self,
    console: Console | None = None,
    *,
    columns: Iterable[RichHandlerColumn] | None = None,
    level: int = logging.NOTSET,
) -> None:
    super().__init__(level=level)
    columns = _default_columns() if columns is None else list(columns)
    if console is None:
        console = get_console(stderr=True)
    self.columns = columns
    self.console = console
    self.highlighter = ReprHighlighter()

columns instance-attribute ¤

columns: list[RichHandlerColumn] = columns

console instance-attribute ¤

console: Console = console

highlighter instance-attribute ¤

highlighter: Highlighter = ReprHighlighter()

emit ¤

emit(record: LogRecord) -> None
Source code in src/liblaf/grapes/rich/logging/handlers/_handler.py
49
50
51
52
53
54
55
56
57
58
59
60
61
def emit(self, record: logging.LogRecord) -> None:
    self.console.print(
        *self._render(record),
        sep="",
        end="",
        overflow="ignore",
        no_wrap=True,
        highlight=False,
        crop=False,
        soft_wrap=False,
    )
    if (exception := self._render_exception(record)) is not None:
        self.console.print(exception)