From 64766bcb711533712f8402158d2a2f0a1773f79f Mon Sep 17 00:00:00 2001 From: sfaulds Date: Mon, 10 Oct 2016 13:44:06 +1100 Subject: [PATCH] add GA logging to main and service base calls --- default.py | 11 ++++++++++- resources/lib/ga_client.py | 2 +- service.py | 4 ++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/default.py b/default.py index a2fc79bc..ad5cd1a6 100644 --- a/default.py +++ b/default.py @@ -22,6 +22,7 @@ sys.path.append(_BASE_LIB) import entrypoint import loghandler from utils import window, dialog, language as lang +from ga_client import GoogleAnalytics ################################################################################################# @@ -156,5 +157,13 @@ class Main(object): if __name__ == "__main__": log.info("plugin.video.emby started") - Main() + + try: + 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") diff --git a/resources/lib/ga_client.py b/resources/lib/ga_client.py index fb9437b0..b61a2564 100644 --- a/resources/lib/ga_client.py +++ b/resources/lib/ga_client.py @@ -11,7 +11,7 @@ log = logging.getLogger("EMBY."+__name__) class GoogleAnalytics(): - testing = True + testing = False def __init__(self): diff --git a/service.py b/service.py index b9ace1c0..acefa7ad 100644 --- a/service.py +++ b/service.py @@ -21,6 +21,7 @@ sys.path.append(_BASE_LIB) import loghandler from service_entry import Service from utils import settings +from ga_client import GoogleAnalytics ################################################################################################# @@ -41,6 +42,9 @@ if __name__ == "__main__": # Start the service service.service_entry_point() except Exception as error: + ga = GoogleAnalytics() + errStrings = ga.formatException() + ga.sendEventData("Exception", errStrings[0], errStrings[1]) log.exception(error) log.info("Forcing shutdown") service.shutdown()