Skip to content

Commit

Permalink
Document "loguru-config" library to configure logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Delgan committed Jul 15, 2023
1 parent 493fb2d commit 4f5af16
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ Take the tour
.. |better_exceptions| replace:: ``better_exceptions``
.. _better_exceptions: https://github.com/Qix-/better-exceptions

.. |loguru-config| replace:: ``loguru-config``
.. _loguru-config: https://github.com/erezinman/loguru-config

.. |notifiers| replace:: ``notifiers``
.. _notifiers: https://github.com/notifiers/notifiers

Expand Down Expand Up @@ -383,6 +386,7 @@ Using the logger in your scripts is easy, and you can |configure|_ it at start.
logger.enable("my_library")
logger.info("This message however is propagated to the sinks")

For additional convenience, you can also use the |loguru-config|_ library to setup the ``logger`` directly from a configuration file.

Entirely compatible with standard logging
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
11 changes: 10 additions & 1 deletion loguru/_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,15 @@
.. |better_exceptions| replace:: ``better_exceptions``
.. _better_exceptions: https://github.com/Qix-/better-exceptions
.. |loguru-config| replace:: ``loguru-config``
.. _loguru-config: https://github.com/erezinman/loguru-config
.. _Pendulum: https://pendulum.eustace.io/docs/#tokens
.. _@sdispater: https://github.com/sdispater
.. _@Qix-: https://github.com/Qix-
.. _@erezinman: https://github.com/erezinman
.. _@sdispater: https://github.com/sdispater
.. _formatting directives: https://docs.python.org/3/library/string.html#format-string-syntax
.. _reentrant: https://en.wikipedia.org/wiki/Reentrancy_(computing)
"""
Expand Down Expand Up @@ -1664,6 +1670,9 @@ def configure(self, *, handlers=None, levels=None, extra=None, patcher=None, act
It should be noted that ``extra`` values set using this function are available across all
modules, so this is the best way to set overall default values.
To load the configuration directly from a file, such as JSON or YAML, it is also possible to
use the |loguru-config|_ library developed by `@erezinman`_.
Parameters
----------
handlers : |list| of |dict|, optional
Expand Down

0 comments on commit 4f5af16

Please sign in to comment.