Merge branch 'master' of github.com:willmcgugan/rich

This commit is contained in:
Will McGugan 2020-05-05 10:14:40 +01:00
commit 41cc14db32
2 changed files with 3 additions and 2 deletions

View File

@ -109,7 +109,7 @@ The log method could be used for logging to the terminal for long running applic
### 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:
![Logging](https://github.com/willmcgugan/rich/blob/master/imgs/logging.png)

View File

@ -31,6 +31,7 @@ The ``__console__`` method should accept a :class:`~rich.console.Console` and a
Here's an example of a ``__console__`` method::
from rich.console import Console, ConsoleOptions, RenderResult
from rich.table import Table
@dataclass
class Student:
@ -39,7 +40,7 @@ Here's an example of a ``__console__`` method::
age: int
def __console__(self, console: Console, options: ConsoleOptions) -> RenderResult:
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("age", str(self.age))
yield my_table