mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 10:17:59 -05:00
Merge V3/feature/audio into V3/develop (a.k.a. audio refactor) (#3459)
This commit is contained in:
17
redbot/cogs/audio/audio_logging.py
Normal file
17
redbot/cogs/audio/audio_logging.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import logging
|
||||
import sys
|
||||
from typing import Final
|
||||
|
||||
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) -> 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)
|
||||
Reference in New Issue
Block a user