mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-08 02:12:32 -05:00
Bump RLL and improve logging (#5044)
* version bump * - bump RLL - logging changes - player.channel.guild->player.guild - small cleanup around logging changes * missed one * here this one too * Apply suggestions from code review Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com> * add one missing player log * missed one * Format with Black Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from typing import Final
|
||||
from typing import Final, Any, Tuple
|
||||
|
||||
IS_DEBUG: Final[bool] = "--debug" in sys.argv
|
||||
|
||||
@@ -10,9 +10,9 @@ def is_debug() -> bool:
|
||||
return IS_DEBUG
|
||||
|
||||
|
||||
def debug_exc_log(lg: logging.Logger, exc: Exception, msg: str = None) -> None:
|
||||
def debug_exc_log(lg: logging.Logger, exc: Exception, msg: str = None, *args: Tuple[Any]) -> None:
|
||||
"""Logs an exception if logging is set to DEBUG level"""
|
||||
if lg.getEffectiveLevel() <= logging.DEBUG:
|
||||
if msg is None:
|
||||
msg = f"{exc}"
|
||||
lg.exception(msg, exc_info=exc)
|
||||
lg.exception(msg, *args, exc_info=exc)
|
||||
|
||||
Reference in New Issue
Block a user