diff options
| author | Hornwitser <[email protected]> | 2015-10-22 21:23:36 +0200 |
|---|---|---|
| committer | Hornwitser <[email protected]> | 2015-10-22 22:07:50 +0200 |
| commit | 320cd39b6ac2bfd63a2498ee481c7e0c8ba98b8e (patch) | |
| tree | 1b86757f2bad14cf9d705b22ea71d27b79ad7fa9 /discord | |
| parent | Add instructions for installing development version. (diff) | |
| download | discord.py-320cd39b6ac2bfd63a2498ee481c7e0c8ba98b8e.tar.xz discord.py-320cd39b6ac2bfd63a2498ee481c7e0c8ba98b8e.zip | |
Print to stderr in on_error
Apparently the clever hack for logging in on_error was not so clever
after all. If logging isn't configured, by the logging modules
definition of not configured, which is root logger not having an
Handlers attached, it will call logging.basicConfig(). Which messes up
setups that define handlers for other loggers than the root logger.
Going directly to the root logger rather than using the broken
convenience methods for logger is not an option either, as logger before
Python 3.2 does not have lastResort on the root logger, and prints an
error when invoked without any handlers.
Resolve by printing tracebacks to stderr by default in on_error.
Diffstat (limited to 'discord')
| -rw-r--r-- | discord/client.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/discord/client.py b/discord/client.py index c2a13618..f68be4a6 100644 --- a/discord/client.py +++ b/discord/client.py @@ -24,6 +24,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ +from __future__ import print_function + from . import endpoints from .errors import InvalidEventName, InvalidDestination, GatewayNotFound from .user import User @@ -34,6 +36,7 @@ from .message import Message from . import utils from .invite import Invite +import traceback import requests import json, re, time, copy from collections import deque @@ -482,7 +485,8 @@ class Client(object): raise InvalidDestination('Destination must be Channel, PrivateChannel, User, or str') def on_error(self, event_method, *args, **kwargs): - logging.exception('Ignoring exception in {}'.format(event_method)) + print('Ignoring exception in {}'.format(event_method), file=sys.stderr) + traceback.print_exc() # Compatibility shim def __getattr__(self, name): |