mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-06 01:12:33 -05:00
Audio cleanup (#5618)
* add different logging level callbacks for task exception logging * Add callback to tasks which didn't have them * The boring stuff - (apply .trace() and .verbose() to audio, stop using debug_exc_log, delete audio_logging.py) * Unsured import cleanup * use new lavalink method * return so it doesn't log this twice. * improve logging on main event handler
This commit is contained in:
@@ -216,12 +216,30 @@ class PlaylistScope(Enum):
|
||||
return list(map(lambda c: c.value, PlaylistScope))
|
||||
|
||||
|
||||
def task_callback(task: asyncio.Task) -> None:
|
||||
def task_callback_exception(task: asyncio.Task) -> None:
|
||||
with contextlib.suppress(asyncio.CancelledError, asyncio.InvalidStateError):
|
||||
if exc := task.exception():
|
||||
log.exception("%s raised an Exception", task.get_name(), exc_info=exc)
|
||||
|
||||
|
||||
def task_callback_debug(task: asyncio.Task) -> None:
|
||||
with contextlib.suppress(asyncio.CancelledError, asyncio.InvalidStateError):
|
||||
if exc := task.exception():
|
||||
log.debug("%s raised an Exception", task.get_name(), exc_info=exc)
|
||||
|
||||
|
||||
def task_callback_verbose(task: asyncio.Task) -> None:
|
||||
with contextlib.suppress(asyncio.CancelledError, asyncio.InvalidStateError):
|
||||
if exc := task.exception():
|
||||
log.verbose("%s raised an Exception", task.get_name(), exc_info=exc)
|
||||
|
||||
|
||||
def task_callback_trace(task: asyncio.Task) -> None:
|
||||
with contextlib.suppress(asyncio.CancelledError, asyncio.InvalidStateError):
|
||||
if exc := task.exception():
|
||||
log.trace("%s raised an Exception", task.get_name(), exc_info=exc)
|
||||
|
||||
|
||||
def has_internal_server():
|
||||
async def pred(ctx: commands.Context):
|
||||
external = await ctx.cog.config.use_external_lavalink()
|
||||
|
||||
Reference in New Issue
Block a user