mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
* 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>
19 lines
465 B
Python
19 lines
465 B
Python
import logging
|
|
import sys
|
|
|
|
from typing import Final, Any, Tuple
|
|
|
|
IS_DEBUG: Final[bool] = "--debug" in sys.argv
|
|
|
|
|
|
def is_debug() -> bool:
|
|
return IS_DEBUG
|
|
|
|
|
|
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, *args, exc_info=exc)
|