add GA logging to main and service base calls

This commit is contained in:
sfaulds 2016-10-10 13:44:06 +11:00
parent e9be0ae64a
commit 64766bcb71
3 changed files with 15 additions and 2 deletions

View file

@ -22,6 +22,7 @@ sys.path.append(_BASE_LIB)
import entrypoint import entrypoint
import loghandler import loghandler
from utils import window, dialog, language as lang from utils import window, dialog, language as lang
from ga_client import GoogleAnalytics
################################################################################################# #################################################################################################
@ -156,5 +157,13 @@ class Main(object):
if __name__ == "__main__": if __name__ == "__main__":
log.info("plugin.video.emby started") log.info("plugin.video.emby started")
try:
Main() Main()
except Exception as error:
ga = GoogleAnalytics()
errStrings = ga.formatException()
ga.sendEventData("Exception", errStrings[0], errStrings[1])
log.exception(error)
log.info("plugin.video.emby stopped") log.info("plugin.video.emby stopped")

View file

@ -11,7 +11,7 @@ log = logging.getLogger("EMBY."+__name__)
class GoogleAnalytics(): class GoogleAnalytics():
testing = True testing = False
def __init__(self): def __init__(self):

View file

@ -21,6 +21,7 @@ sys.path.append(_BASE_LIB)
import loghandler import loghandler
from service_entry import Service from service_entry import Service
from utils import settings from utils import settings
from ga_client import GoogleAnalytics
################################################################################################# #################################################################################################
@ -41,6 +42,9 @@ if __name__ == "__main__":
# Start the service # Start the service
service.service_entry_point() service.service_entry_point()
except Exception as error: except Exception as error:
ga = GoogleAnalytics()
errStrings = ga.formatException()
ga.sendEventData("Exception", errStrings[0], errStrings[1])
log.exception(error) log.exception(error)
log.info("Forcing shutdown") log.info("Forcing shutdown")
service.shutdown() service.shutdown()