Skip to content

Commit

Permalink
Add note about "logger" being non-reentrant in docs (#390)
Browse files Browse the repository at this point in the history
  • Loading branch information
Delgan committed Mar 19, 2021
1 parent 3f2b498 commit 4e6cbd4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions loguru/_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
.. |timedelta| replace:: :class:`datetime.timedelta`
.. |open| replace:: :func:`open()`
.. |logging| replace:: :mod:`logging`
.. |signal| replace:: :mod:`logging`
.. |contextvars| replace:: :mod:`contextvars`
.. |Thread.run| replace:: :meth:`Thread.run()<threading.Thread.run()>`
.. |Exception| replace:: :class:`Exception`
Expand Down Expand Up @@ -69,6 +70,7 @@
.. _@sdispater: https://github.com/sdispater
.. _@Qix-: https://github.com/Qix-
.. _Formatting directives: https://docs.python.org/3/library/string.html#format-string-syntax
.. _reentrant: https://en.wikipedia.org/wiki/Reentrancy_(computing)
"""
import asyncio
import builtins
Expand Down Expand Up @@ -345,8 +347,9 @@ def add(
- A built-in |Handler| like ``logging.StreamHandler``. In such a case, the `Loguru` records
are automatically converted to the structure expected by the |logging| module.
Note that you should avoid using the ``logger`` inside any of your sinks as this would
result in infinite recursion or dead lock if the module's sink was not explicitly disabled.
Note that the logging functions are not `reentrant`_. This means you should avoid using
the ``logger`` inside any of your sinks or from within |signal| handlers. Otherwise, you
may face deadlock if the module's sink was not explicitly disabled.
.. _message:
Expand Down

0 comments on commit 4e6cbd4

Please sign in to comment.