mirror of https://github.com/Textualize/rich.git
Merge branch 'master' of github.com:willmcgugan/rich
This commit is contained in:
commit
41cc14db32
|
@ -109,7 +109,7 @@ The log method could be used for logging to the terminal for long running applic
|
||||||
|
|
||||||
### Logging Handler
|
### Logging Handler
|
||||||
|
|
||||||
You can also use the builtin [Handler class](https://rich.readthedocs.io/en/latest/logging.html) to format and colorize output form Python's logging module. Here's an example of the output:
|
You can also use the builtin [Handler class](https://rich.readthedocs.io/en/latest/logging.html) to format and colorize output from Python's logging module. Here's an example of the output:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ The ``__console__`` method should accept a :class:`~rich.console.Console` and a
|
||||||
Here's an example of a ``__console__`` method::
|
Here's an example of a ``__console__`` method::
|
||||||
|
|
||||||
from rich.console import Console, ConsoleOptions, RenderResult
|
from rich.console import Console, ConsoleOptions, RenderResult
|
||||||
|
from rich.table import Table
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Student:
|
class Student:
|
||||||
|
@ -39,7 +40,7 @@ Here's an example of a ``__console__`` method::
|
||||||
age: int
|
age: int
|
||||||
def __console__(self, console: Console, options: ConsoleOptions) -> RenderResult:
|
def __console__(self, console: Console, options: ConsoleOptions) -> RenderResult:
|
||||||
yield f"[b]Student:[/b] #{self.id}"
|
yield f"[b]Student:[/b] #{self.id}"
|
||||||
my_table = Table("Attribute, "Value")
|
my_table = Table("Attribute", "Value")
|
||||||
my_table.add_row("name", self.name)
|
my_table.add_row("name", self.name)
|
||||||
my_table.add_row("age", str(self.age))
|
my_table.add_row("age", str(self.age))
|
||||||
yield my_table
|
yield my_table
|
||||||
|
|
Loading…
Reference in New Issue