🏓 移除 sentry

This commit is contained in:
xtaodada 2020-08-09 13:55:02 +08:00
parent 5a8bf2e1d8
commit 85f61242c5
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 6 additions and 23 deletions

View File

@ -1,5 +1,6 @@
""" PagerMaid event listener. """ """ PagerMaid event listener. """
from os.path import exists
from telethon import events from telethon import events
from telethon.errors import MessageTooLongError from telethon.errors import MessageTooLongError
from distutils2.util import strtobool from distutils2.util import strtobool
@ -9,14 +10,7 @@ from sys import exc_info
from telethon.events import StopPropagation from telethon.events import StopPropagation
from pagermaid import bot, config, help_messages from pagermaid import bot, config, help_messages
from pagermaid.utils import attach_log from pagermaid.utils import attach_log
try:
import sentry_sdk
from sentry_sdk import capture_message, configure_scope
except:
pass
def strip_sentry(event, hint):
return None
def listener(**args): def listener(**args):
""" Register an event listener. """ """ Register an event listener. """
@ -79,21 +73,11 @@ def listener(**args):
f"# Traceback: \n-----BEGIN TRACEBACK-----\n" \ f"# Traceback: \n-----BEGIN TRACEBACK-----\n" \
f"{str(format_exc())}\n-----END TRACEBACK-----\n" \ f"{str(format_exc())}\n-----END TRACEBACK-----\n" \
f"# Error: \"{str(exc_info()[1])}\". \n" f"# Error: \"{str(exc_info()[1])}\". \n"
report_sentry = f"# M: {context.text}\n" \ if exists('/var/lib/pagermaid/public.lock'):
f"# Trace: \n" \ invite_chatid = -1001213866307
f"{str(format_exc())}\n" \ else:
f"# Error: \"{str(exc_info()[1])}\". \n" invite_chatid = -1001441461877
try: await attach_log(report, invite_chatid, f"exception.{time()}.pagermaid", None,
sentry_sdk.init("https://969892b513374f75916aaac1014aa7c2@o416616.ingest.sentry.io/5312335", release="d6f5b9725459f5d0cf96f005bf584d1a7235c405")
with configure_scope() as scope:
scope.user = eval('{"id": "' + str(context.sender_id) + '"}')
scope.set_tag("ChatID", f"{str(context.chat_id)}")
scope.level = 'error'
capture_message(report_sentry)
sentry_sdk.init("https://969892b513374f75916aaac1014aa7c2@o416616.ingest.sentry.io/5312335", release="d6f5b9725459f5d0cf96f005bf584d1a7235c405", before_send=strip_sentry)
except:
pass
await attach_log(report, -1001441461877, f"exception.{time()}.pagermaid", None,
"Error report generated.") "Error report generated.")
if not ignore_edited: if not ignore_edited:

View File

@ -31,5 +31,4 @@ flask_bcrypt
flask_wtf flask_wtf
wtforms wtforms
cheroot cheroot
sentry-sdk==0.16.0
PySocks PySocks