Browse Source

Change View, Modal, and AudioPlayer to use logger instead of stderr

pull/10109/head
mniip 3 years ago
committed by dolfies
parent
commit
08c9da6e89
  1. 9
      discord/player.py
  2. 5
      discord/voice_client.py
  3. 1
      docs/migrating.rst

9
discord/player.py

@ -24,7 +24,6 @@ DEALINGS IN THE SOFTWARE.
from __future__ import annotations
import threading
import traceback
import subprocess
import audioop
import asyncio
@ -709,14 +708,10 @@ class AudioPlayer(threading.Thread):
try:
self.after(error)
except Exception as exc:
_log.exception('Calling the after function failed.')
exc.__context__ = error
traceback.print_exception(type(exc), exc, exc.__traceback__)
_log.exception('Calling the after function failed.', exc_info=exc)
elif error:
msg = f'Exception in voice thread {self.name}'
_log.exception(msg, exc_info=error)
print(msg, file=sys.stderr)
traceback.print_exception(type(error), error, error.__traceback__)
_log.exception('Exception in voice thread %s.', self.name, exc_info=error)
def stop(self) -> None:
self._end.set()

5
discord/voice_client.py

@ -587,7 +587,10 @@ class VoiceClient(VoiceProtocol):
If an error happens while the audio player is running, the exception is
caught and the audio player is then stopped. If no after callback is
passed, any caught exception will be displayed as if it were raised.
passed, any caught exception will be logged using the library logger.
.. versionchanged:: 2.0
Instead of writing to ``sys.stderr``, the library's logger is used.
Parameters
-----------

1
docs/migrating.rst

@ -852,6 +852,7 @@ The library now provides a default logging configuration if using :meth:`Client.
- :meth:`Client.on_error`
- :meth:`discord.ext.tasks.Loop.error`
- :meth:`discord.ext.commands.Bot.on_command_error`
- :meth:`VoiceClient.play`
For more information, check :doc:`logging`.

Loading…
Cancel
Save