mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-19 04:09:40 +08:00
Add initial stubs for sentry logging
This commit is contained in:
parent
74b5af3edd
commit
23057f786f
@ -13,6 +13,9 @@ import ssl
|
|||||||
import urllib.request
|
import urllib.request
|
||||||
import urllib.error
|
import urllib.error
|
||||||
|
|
||||||
|
from sentry_sdk.hub import Hub
|
||||||
|
from sentry_sdk.utils import capture_internal_exceptions, event_from_exception
|
||||||
|
|
||||||
import certifi
|
import certifi
|
||||||
|
|
||||||
from PyQt5.QtCore import QT_VERSION_STR, PYQT_VERSION_STR, QUrl
|
from PyQt5.QtCore import QT_VERSION_STR, PYQT_VERSION_STR, QUrl
|
||||||
@ -365,15 +368,14 @@ class CrashHandler:
|
|||||||
print("Sending crash report info to [%s]...\n" % self.crash_url)
|
print("Sending crash report info to [%s]...\n" % self.crash_url)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
f = urllib.request.urlopen(self.crash_url, **kwoptions)
|
hub = Hub.current
|
||||||
Logger.log("i", "Sent crash report info.")
|
client = hub.client
|
||||||
if not self.has_started:
|
event, hint = event_from_exception((self.exception_type, self.value, self.traceback),
|
||||||
print("Sent crash report info.\n")
|
client_options=client.options,
|
||||||
f.close()
|
mechanism={"type": "excepthook", "handled": False},
|
||||||
except urllib.error.HTTPError as e:
|
)
|
||||||
Logger.logException("e", "An HTTP error occurred while trying to send crash report")
|
hub.capture_event(event, hint=hint)
|
||||||
if not self.has_started:
|
hub.flush()
|
||||||
print("An HTTP error occurred while trying to send crash report: %s" % e)
|
|
||||||
except Exception as e: # We don't want any exception to cause problems
|
except Exception as e: # We don't want any exception to cause problems
|
||||||
Logger.logException("e", "An exception occurred while trying to send crash report")
|
Logger.logException("e", "An exception occurred while trying to send crash report")
|
||||||
if not self.has_started:
|
if not self.has_started:
|
||||||
|
@ -9,8 +9,11 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from UM.Platform import Platform
|
from UM.Platform import Platform
|
||||||
|
from cura import ApplicationMetadata
|
||||||
from cura.ApplicationMetadata import CuraAppName
|
from cura.ApplicationMetadata import CuraAppName
|
||||||
|
|
||||||
|
import sentry_sdk
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(prog = "cura",
|
parser = argparse.ArgumentParser(prog = "cura",
|
||||||
add_help = False)
|
add_help = False)
|
||||||
parser.add_argument("--debug",
|
parser.add_argument("--debug",
|
||||||
@ -18,7 +21,9 @@ parser.add_argument("--debug",
|
|||||||
default = False,
|
default = False,
|
||||||
help = "Turn on the debug mode by setting this option."
|
help = "Turn on the debug mode by setting this option."
|
||||||
)
|
)
|
||||||
|
|
||||||
known_args = vars(parser.parse_known_args()[0])
|
known_args = vars(parser.parse_known_args()[0])
|
||||||
|
sentry_sdk.init("https://5034bf0054fb4b889f82896326e79b13@sentry.io/1821564", release = "cura%s" % ApplicationMetadata.CuraVersion, default_integrations=False )
|
||||||
|
|
||||||
if not known_args["debug"]:
|
if not known_args["debug"]:
|
||||||
def get_cura_dir_path():
|
def get_cura_dir_path():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user