remove logging, only log in TEST mode which needs to be turned on with a code change.

This commit is contained in:
shaun 2016-11-06 10:38:33 +11:00
parent 48405f6215
commit e689b29e18

View file

@ -6,8 +6,6 @@ import logging
import clientinfo import clientinfo
import hashlib import hashlib
import xbmc import xbmc
import platform
import xbmcgui
import time import time
from utils import window, settings, language as lang from utils import window, settings, language as lang
@ -93,7 +91,7 @@ class GoogleAnalytics():
allStackFrames = traceback.extract_tb(exc_tb) allStackFrames = traceback.extract_tb(exc_tb)
if(len(allStackFrames) > 0): if(len(allStackFrames) > 0):
latestStackFrame = allStackFrames[-1] latestStackFrame = allStackFrames[-1]
log.error(str(latestStackFrame)) #log.error(str(latestStackFrame))
errorType = "NA" errorType = "NA"
errorFile = "NA" errorFile = "NA"
@ -108,7 +106,7 @@ class GoogleAnalytics():
errorFile = "%s:%s(%s)(%s)" % (fileName, latestStackFrame[1], exc_obj.message, codeLine) errorFile = "%s:%s(%s)(%s)" % (fileName, latestStackFrame[1], exc_obj.message, codeLine)
errorFile = errorFile[0:499] errorFile = errorFile[0:499]
errorType = "%s" % (exc_type.__name__) errorType = "%s" % (exc_type.__name__)
log.error(errorType + " - " + errorFile) #log.error(errorType + " - " + errorFile)
del(exc_type, exc_obj, exc_tb) del(exc_type, exc_obj, exc_tb)
@ -158,7 +156,7 @@ class GoogleAnalytics():
if(lastLogged != None): if(lastLogged != None):
timeSinceLastLog = time.time() - lastLogged timeSinceLastLog = time.time() - lastLogged
if(timeSinceLastLog < 300): if(timeSinceLastLog < 300):
log.info("SKIPPING_LOG_EVENT : " + str(timeSinceLastLog) + " " + throttleKey) #log.info("SKIPPING_LOG_EVENT : " + str(timeSinceLastLog) + " " + throttleKey)
return return
logEventHistory[throttleKey] = time.time() logEventHistory[throttleKey] = time.time()
@ -174,11 +172,12 @@ class GoogleAnalytics():
def sendData(self, data): def sendData(self, data):
log.info("GA: " + str(data))
if(settings('metricLogging') == "false"): if(settings('metricLogging') == "false"):
return return
if (self.testing):
log.info("GA: " + str(data))
if(self.testing): if(self.testing):
url = "https://www.google-analytics.com/debug/collect" # test URL url = "https://www.google-analytics.com/debug/collect" # test URL
else: else:
@ -188,8 +187,9 @@ class GoogleAnalytics():
r = requests.post(url, data) r = requests.post(url, data)
except Exception as error: except Exception as error:
log.error(error) log.error(error)
r = None
if(self.testing): if(self.testing and r != None):
log.info("GA: " + r.text.encode('utf-8')) log.info("GA: " + r.text.encode('utf-8'))