From 23daac5d01de0f43ae02ac09eb477b279bfae4a8 Mon Sep 17 00:00:00 2001 From: Joe Halliwell Date: Sun, 12 Dec 2021 11:17:48 +0000 Subject: [PATCH] Add documentation --- docs/source/logging.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/source/logging.rst b/docs/source/logging.rst index b9077188..38daaf1f 100644 --- a/docs/source/logging.rst +++ b/docs/source/logging.rst @@ -16,10 +16,14 @@ Here's an example of how to set up a rich logger:: log = logging.getLogger("rich") log.info("Hello, World!") -Rich logs won't render :ref:`console_markup` in logging by default as most libraries won't be aware of the need to escape literal square brackets, but you can enable it by setting ``markup=True`` on the handler. Alternatively you can enable it per log message by supplying the ``extra`` argument as follows:: +Rich logs won't render :ref:`console_markup` in logging by default as most libraries won't be aware of the need to escape literal square brackets, but you can enable it by setting ``markup=True`` on the handler. Alternatively you can enable it per log message by supplying the ``extra`` argument as follows:: log.error("[bold red blink]Server is shutting down![/]", extra={"markup": True}) +Similarly, the highlighter may be overridden per log message:: + + log.error("123 will not be highlighted", extra={"highlighter": None}) + Handle exceptions -------------------