Clean up mixpanel analytics a bit.

This commit is contained in:
Jake Moshenko 2016-10-13 15:02:37 -04:00
parent 6266dd0ea4
commit 013e27f7d5

View file

@ -37,7 +37,7 @@ class SendToMixpanel(Thread):
logger.exception('Failed to send Mixpanel request.')
class FakeMixpanel(object):
class _FakeMixpanel(object):
def track(*args, **kwargs):
pass
@ -55,15 +55,14 @@ class Analytics(object):
if analytics_type == 'Mixpanel':
mixpanel_key = app.config.get('MIXPANEL_KEY', '')
logger.debug('Initializing mixpanel with key: %s' %
app.config['MIXPANEL_KEY'])
logger.debug('Initializing mixpanel with key: %s', app.config['MIXPANEL_KEY'])
request_queue = Queue()
analytics = Mixpanel(mixpanel_key, MixpanelQueuingConsumer(request_queue))
SendToMixpanel(request_queue).start()
else:
analytics = FakeMixpanel()
analytics = _FakeMixpanel()
# register extension with app
app.extensions = getattr(app, 'extensions', {})