Change stderr prints to use the logging module instead

This commit is contained in:
Rapptz
2022-06-13 00:57:28 -04:00
parent 49e683541b
commit 53685b9b86
6 changed files with 40 additions and 29 deletions

View File

@@ -29,7 +29,6 @@ import datetime
import logging
import sys
import os
import traceback
from typing import (
Any,
AsyncIterator,
@@ -519,16 +518,16 @@ class Client:
The default error handler provided by the client.
By default this prints to :data:`sys.stderr` however it could be
By default this logs to the library logger however it could be
overridden to have a different implementation.
Check :func:`~discord.on_error` for more details.
.. versionchanged:: 2.0
``event_method`` parameter is now positional-only.
``event_method`` parameter is now positional-only
and instead of writing to ``sys.stderr`` it logs instead.
"""
print(f'Ignoring exception in {event_method}', file=sys.stderr)
traceback.print_exc()
_log.exception('Ignoring exception in %s', event_method)
# hooks