Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using consistent log messages in example docs #120

Merged
merged 2 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/integrations/loguru.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/integrations/structlog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ 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.

.. 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.


Expand Down
4 changes: 2 additions & 2 deletions docs/log-capturing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::

Expand All @@ -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`!
Expand Down
2 changes: 1 addition & 1 deletion docs/using-unittest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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() <unittest.TestCase.assertLogs>`
Expand Down