Sentry removal (#2439)

Resolves #2430.
This commit is contained in:
Twentysix
2019-02-11 01:19:02 +01:00
committed by Toby Harradine
parent dae75521d3
commit 889fa63aff
10 changed files with 7 additions and 199 deletions

View File

@@ -19,34 +19,18 @@ from .utils.chat_formatting import inline, bordered, format_perms_list
from .utils import fuzzy_command_search, format_fuzzy_results
log = logging.getLogger("red")
sentry_log = logging.getLogger("red.sentry")
init()
INTRO = """
______ _ ______ _ _ ______ _
| ___ \ | | | _ (_) | | | ___ \ | |
| |_/ /___ __| | ______ | | | |_ ___ ___ ___ _ __ __| | | |_/ / ___ | |_
______ _ ______ _ _ ______ _
| ___ \ | | | _ (_) | | | ___ \ | |
| |_/ /___ __| | ______ | | | |_ ___ ___ ___ _ __ __| | | |_/ / ___ | |_
| // _ \/ _` | |______| | | | | / __|/ __/ _ \| '__/ _` | | ___ \/ _ \| __|
| |\ \ __/ (_| | | |/ /| \__ \ (_| (_) | | | (_| | | |_/ / (_) | |_
| |\ \ __/ (_| | | |/ /| \__ \ (_| (_) | | | (_| | | |_/ / (_) | |_
\_| \_\___|\__,_| |___/ |_|___/\___\___/|_| \__,_| \____/ \___/ \__|
"""
def should_log_sentry(exception) -> bool:
e = exception
while e.__cause__ is not None:
e = e.__cause__
tb = e.__traceback__
tb_frame = None
while tb is not None:
tb_frame = tb.tb_frame
tb = tb.tb_next
module = tb_frame.f_globals.get("__name__")
return module is not None and module.startswith("redbot")
def init_events(bot, cli_flags):
@bot.event
async def on_connect():
@@ -142,7 +126,6 @@ def init_events(bot, cli_flags):
)
INFO2 = []
sentry = await bot.db.enable_sentry()
mongo_enabled = storage_type() != "JSON"
reqs_installed = {"docs": None, "test": None}
for key in reqs_installed.keys():
@@ -155,7 +138,6 @@ def init_events(bot, cli_flags):
reqs_installed[key] = True
options = (
("Error Reporting", sentry),
("MongoDB", mongo_enabled),
("Voice", True),
("Docs", reqs_installed["docs"]),
@@ -177,10 +159,6 @@ def init_events(bot, cli_flags):
bot.color = discord.Colour(await bot.db.color())
@bot.event
async def on_error(event_method, *args, **kwargs):
sentry_log.exception("Exception in {}".format(event_method))
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
@@ -201,11 +179,6 @@ def init_events(bot, cli_flags):
"Exception in command '{}'".format(ctx.command.qualified_name),
exc_info=error.original,
)
if should_log_sentry(error):
sentry_log.exception(
"Exception in command '{}'".format(ctx.command.qualified_name),
exc_info=error.original,
)
message = "Error in command '{}'. Check your console or logs for details.".format(
ctx.command.qualified_name
@@ -245,13 +218,6 @@ def init_events(bot, cli_flags):
)
else:
log.exception(type(error).__name__, exc_info=error)
try:
sentry_error = error.original
except AttributeError:
sentry_error = error
if should_log_sentry(sentry_error):
sentry_log.exception("Unhandled command error.", exc_info=sentry_error)
@bot.event
async def on_message(message):