This commit is contained in:
Will McGugan 2020-03-27 08:58:22 +00:00
parent 23cbd4a409
commit 3f6ee447e0
3 changed files with 6 additions and 6 deletions

View File

@ -99,9 +99,9 @@ Note the `log_locals` argument, which outputs a table containing the local varia
The log method could be used for logging to the terminal for long running applications such as servers, but is also a very nice debugging aid.
You can also use the builtin logging Handler class, 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 to format and colorize output form Python's logging module. Here's an example of the output:
![Log](./imgs/logging.png)
![Logging](https://github.com/willmcgugan/rich/blob/master/imgs/logging.png)
## Emoji

View File

@ -1,5 +1,5 @@
Logging
=======
Logging Handler
===============
Rich supplies a :ref:`logging handler<logging>` which will format and colorize text written by Python's logging module.
@ -12,6 +12,6 @@ Here's an example of how to set up a rich logger::
logging.basicConfig(
level="NOTSET", format=FORMAT, datefmt="[%X] ", handlers=[RichHandler()]
)
log = logging.getLogger("rich")
log.info("Hello, World!")

View File

@ -16,7 +16,7 @@ class RichHandler(Handler):
"""A logging handler that renders output with Rich. The time / level / message and file are displayed in columns. The
level is color coded, and the message is syntax highlighted.
Example:
Example::
import logging
from rich.logging import RichHandler