mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-08 02:43:01 +00:00
Change View, Modal, and AudioPlayer to use logger instead of stderr
This commit is contained in:
@ -27,8 +27,6 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
from copy import deepcopy
|
||||
from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence, ClassVar, List
|
||||
|
||||
@ -154,7 +152,7 @@ class Modal(View):
|
||||
A callback that is called when :meth:`on_submit`
|
||||
fails with an error.
|
||||
|
||||
The default implementation prints the traceback to stderr.
|
||||
The default implementation logs to the library logger.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
@ -163,8 +161,7 @@ class Modal(View):
|
||||
error: :class:`Exception`
|
||||
The exception that was raised.
|
||||
"""
|
||||
print(f'Ignoring exception in modal {self}:', file=sys.stderr)
|
||||
traceback.print_exception(error.__class__, error, error.__traceback__, file=sys.stderr)
|
||||
_log.error('Ignoring exception in modal %r:', self, exc_info=error)
|
||||
|
||||
def _refresh(self, components: Sequence[ModalSubmitComponentInteractionDataPayload]) -> None:
|
||||
for component in components:
|
||||
|
@ -27,7 +27,6 @@ from typing import Any, Callable, ClassVar, Coroutine, Dict, Iterator, List, Opt
|
||||
from functools import partial
|
||||
from itertools import groupby
|
||||
|
||||
import traceback
|
||||
import asyncio
|
||||
import logging
|
||||
import sys
|
||||
@ -388,7 +387,7 @@ class View:
|
||||
A callback that is called when an item's callback or :meth:`interaction_check`
|
||||
fails with an error.
|
||||
|
||||
The default implementation prints the traceback to stderr.
|
||||
The default implementation logs to the library logger.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
@ -399,8 +398,7 @@ class View:
|
||||
item: :class:`Item`
|
||||
The item that failed the dispatch.
|
||||
"""
|
||||
print(f'Ignoring exception in view {self} for item {item}:', file=sys.stderr)
|
||||
traceback.print_exception(error.__class__, error, error.__traceback__, file=sys.stderr)
|
||||
_log.error('Ignoring exception in view %r for item %r', self, item, exc_info=error)
|
||||
|
||||
async def _scheduled_task(self, item: Item, interaction: Interaction):
|
||||
try:
|
||||
|
Reference in New Issue
Block a user