mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 02:36:10 +00:00
return error type and file info sepratly
use the error type in the event action and the file and line in the event label
This commit is contained in:
parent
fb0ae730a0
commit
f6f6ae81e4
2 changed files with 12 additions and 8 deletions
|
@ -29,12 +29,13 @@ class GoogleAnalytics():
|
||||||
def formatException(self):
|
def formatException(self):
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
||||||
errorMessage = "%s:%s-%s" % (fname, exc_tb.tb_lineno, exc_type.__name__)
|
errorFile = "%s:%s" % (fname, exc_tb.tb_lineno)
|
||||||
|
errorType = "%s" % (exc_type.__name__)
|
||||||
del(exc_type, exc_obj, exc_tb)
|
del(exc_type, exc_obj, exc_tb)
|
||||||
log.error(errorMessage)
|
log.error(errorType + " - " + errorFile)
|
||||||
return errorMessage
|
return errorType, errorFile
|
||||||
|
|
||||||
def sendEventData(self, eventCategory, eventAction):
|
def sendEventData(self, eventCategory, eventAction, eventLabel=None):
|
||||||
|
|
||||||
if(settings('metricLogging') == "false"):
|
if(settings('metricLogging') == "false"):
|
||||||
return
|
return
|
||||||
|
@ -62,7 +63,9 @@ class GoogleAnalytics():
|
||||||
data['t'] = 'event' # action type
|
data['t'] = 'event' # action type
|
||||||
data['ec'] = eventCategory # Event Category
|
data['ec'] = eventCategory # Event Category
|
||||||
data['ea'] = eventAction # Event Action
|
data['ea'] = eventAction # Event Action
|
||||||
#data['el'] = 'Play' # Event Label
|
|
||||||
|
if(eventLabel != None):
|
||||||
|
data['el'] = eventLabel # Event Label
|
||||||
|
|
||||||
log.info("GA: " + str(data))
|
log.info("GA: " + str(data))
|
||||||
|
|
||||||
|
|
|
@ -968,6 +968,7 @@ class LibrarySync(threading.Thread):
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
val = 1/0
|
||||||
self.run_internal()
|
self.run_internal()
|
||||||
except Warning as e:
|
except Warning as e:
|
||||||
if "restricted" in e:
|
if "restricted" in e:
|
||||||
|
@ -976,8 +977,8 @@ class LibrarySync(threading.Thread):
|
||||||
pass
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
ga = GoogleAnalytics()
|
ga = GoogleAnalytics()
|
||||||
errStr = ga.formatException()
|
errStrings = ga.formatException()
|
||||||
ga.sendEventData("Exception", errStr)
|
ga.sendEventData("Exception", errStrings[0], errStrings[1])
|
||||||
window('emby_dbScan', clear=True)
|
window('emby_dbScan', clear=True)
|
||||||
log.exception(e)
|
log.exception(e)
|
||||||
xbmcgui.Dialog().ok(
|
xbmcgui.Dialog().ok(
|
||||||
|
@ -986,7 +987,7 @@ class LibrarySync(threading.Thread):
|
||||||
"Library sync thread has exited! "
|
"Library sync thread has exited! "
|
||||||
"You should restart Kodi now. "
|
"You should restart Kodi now. "
|
||||||
"Please report this on the forum."),
|
"Please report this on the forum."),
|
||||||
line2=(errStr))
|
line2=(errStrings[0] + " (" + errStrings[1] + ")"))
|
||||||
|
|
||||||
def run_internal(self):
|
def run_internal(self):
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue