mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 02:36:10 +00:00
use last frame from call stack to get file and line number info
This commit is contained in:
parent
acec196995
commit
e9be0ae64a
1 changed files with 21 additions and 6 deletions
|
@ -1,5 +1,6 @@
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import traceback
|
||||||
import requests
|
import requests
|
||||||
import logging
|
import logging
|
||||||
import clientinfo
|
import clientinfo
|
||||||
|
@ -10,7 +11,7 @@ log = logging.getLogger("EMBY."+__name__)
|
||||||
|
|
||||||
class GoogleAnalytics():
|
class GoogleAnalytics():
|
||||||
|
|
||||||
testing = False
|
testing = True
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
|
@ -28,11 +29,25 @@ 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]
|
|
||||||
errorFile = "%s:%s" % (fname, exc_tb.tb_lineno)
|
stackFrames = traceback.extract_tb(exc_tb)
|
||||||
errorType = "%s" % (exc_type.__name__)
|
if(len(stackFrames) > 0):
|
||||||
del(exc_type, exc_obj, exc_tb)
|
stackFrames = traceback.extract_tb(exc_tb)[-1]
|
||||||
log.error(errorType + " - " + errorFile)
|
else:
|
||||||
|
stackFrames = None
|
||||||
|
log.error(str(stackFrames))
|
||||||
|
|
||||||
|
errorType = "NA"
|
||||||
|
errorFile = "NA"
|
||||||
|
|
||||||
|
if(stackFrames != None):
|
||||||
|
fileName = os.path.split(stackFrames[0])[1]
|
||||||
|
|
||||||
|
errorFile = "%s:%s" % (fileName, stackFrames[1])
|
||||||
|
errorType = "%s" % (exc_type.__name__)
|
||||||
|
del(exc_type, exc_obj, exc_tb)
|
||||||
|
log.error(errorType + " - " + errorFile)
|
||||||
|
|
||||||
return errorType, errorFile
|
return errorType, errorFile
|
||||||
|
|
||||||
def sendEventData(self, eventCategory, eventAction, eventLabel=None):
|
def sendEventData(self, eventCategory, eventAction, eventLabel=None):
|
||||||
|
|
Loading…
Reference in a new issue