mirror of
https://github.com/Rapptz/discord.py.git
synced 2026-11-20 13:29:03 +00:00
Add utils.setup_logging to help set up logging outside of Client.run
This commit is contained in:
1 parent
1c7747fe9d
commit
2bf2bfc9b4
5 files changed
+139
-89
No files matched your search
@@ -43,6 +43,17 @@ Likewise, configuring the log level to ``logging.DEBUG`` is also possible:
|
||||
|
||||
This is recommended, especially at verbose levels such as ``DEBUG``, as there are a lot of events logged and it would clog the stderr of your program.
|
||||
|
||||
If you want to setup logging using the library provided configuration without using :meth:`Client.run`, you can use :func:`discord.utils.setup_logging`:
|
||||
|
||||
.. code-block:: python3
|
||||
|
||||
import discord
|
||||
|
||||
discord.utils.setup_logging()
|
||||
|
||||
# or, for example
|
||||
discord.utils.setup_logging(level=logging.INFO, root=False)
|
||||
|
||||
More advanced setups are possible with the :mod:`logging` module. The example below configures a rotating file handler that outputs DEBUG output for everything the library outputs, except for HTTP requests:
|
||||
|
||||
.. code-block:: python3
|
||||
|
||||
Reference in new issue
Block a user