From 4408cbe6e3b0bdd3af4e043f0911120a7bc73c41 Mon Sep 17 00:00:00 2001 From: Dave Hall Date: Mon, 19 Feb 2024 14:22:32 +0000 Subject: [PATCH 1/2] Using consisten log messages in examples --- docs/integrations/loguru.rst | 2 +- docs/integrations/structlog.rst | 2 +- docs/log-capturing.rst | 4 ++-- docs/using-unittest.rst | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/integrations/loguru.rst b/docs/integrations/loguru.rst index 09eaa852..e2a516c6 100644 --- a/docs/integrations/loguru.rst +++ b/docs/integrations/loguru.rst @@ -11,7 +11,7 @@ Using with :mod:`loguru` with Logot(capturer=LoguruCapturer).capturing() as logot: do_something() - logot.assert_logged(logged.info("App started")) + logot.assert_logged(logged.info("Something was done")) Installing diff --git a/docs/integrations/structlog.rst b/docs/integrations/structlog.rst index 6aa5adfe..b463be6e 100644 --- a/docs/integrations/structlog.rst +++ b/docs/integrations/structlog.rst @@ -11,7 +11,7 @@ Using with :mod:`structlog` with Logot(capturer=StructlogCapturer).capturing() as logot: do_something() - logot.assert_logged(logged.info("App started")) + logot.assert_logged(logged.info("Something was done")) :mod:`logot` will capture logs before any processors are invoked. Any filtering, formatting, or other processing from the processor chain will not be applied to the captured logs. diff --git a/docs/log-capturing.rst b/docs/log-capturing.rst index 2c55a97c..d6435e1d 100644 --- a/docs/log-capturing.rst +++ b/docs/log-capturing.rst @@ -9,7 +9,7 @@ Log capturing with Logot().capturing() as logot: do_something() - logot.assert_logged(logged.info("App started")) + logot.assert_logged(logged.info("Something was done")) .. seealso:: @@ -36,7 +36,7 @@ The :meth:`Logot.capturing` method defaults to capturing **all** records from th with Logot().capturing(level=logging.WARNING, name="app") as logot: do_something() - logot.assert_logged(logged.info("App started")) + logot.assert_logged(logged.info("Something was done")) For advanced use-cases, multiple :meth:`Logot.capturing` calls on the same :class:`Logot` instance are supported. Be careful to avoid capturing duplicate logs with overlapping calls to :meth:`Logot.capturing`! diff --git a/docs/using-unittest.rst b/docs/using-unittest.rst index 8e349c02..501b30f3 100644 --- a/docs/using-unittest.rst +++ b/docs/using-unittest.rst @@ -17,7 +17,7 @@ during tests and can be used to make log assertions: def test_something(self) -> None: do_something() - self.logot.assert_logged(logged.info("App started")) + self.logot.assert_logged(logged.info("Something was done")) Comparison to :meth:`assertLogs() ` From 3a964ef0c26d4ab1e601db0a717736bcad53368d Mon Sep 17 00:00:00 2001 From: Dave Hall Date: Mon, 19 Feb 2024 14:23:33 +0000 Subject: [PATCH 2/2] wip --- docs/integrations/structlog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/integrations/structlog.rst b/docs/integrations/structlog.rst index b463be6e..e5390dee 100644 --- a/docs/integrations/structlog.rst +++ b/docs/integrations/structlog.rst @@ -19,7 +19,7 @@ the processor chain will not be applied to the captured logs. .. note:: :class:`logot.structlog.StructlogCapturer` works by changing the :mod:`structlog` configuration. If you have - `cache_logger_on_first_use` enabled in your :func:`structlog.configure` or :func:`structlog.wrap_logger` call for + ``cache_logger_on_first_use`` enabled in your :func:`structlog.configure` or :func:`structlog.wrap_logger` call for performance reasons, you will need to disable it during tests to enable log capturing.