from couchlog.signals import couchlog_created def add_hq_extras(record, **kwargs): """ Adds the domain to the couchlog item so that it can be later analyzed. """ if "/a/" in record.url: # this is a normal browser 500 errorx record.domain = record.url.split("/a/")[1].split("/")[0] record.save() elif "/a/" in record.message: # this match is a bit sketchier, but couchforms has been designed # to put the path in the message which is what we're trying to catch # here record.domain = record.message.split("/a/")[1].split("/")[0] record.save() couchlog_created.connect(add_hq_extras)
from django.conf import settings from couchlog.signals import couchlog_created def add_bhoma_extras(record, **kwargs): # bolt on the clinic code and app version, as well as our extra_info record.clinic_id = settings.BHOMA_CLINIC_ID if not settings.BHOMA_IS_DHMT \ else "%sDHMT" % settings.BHOMA_CLINIC_ID record.commit_id = settings.BHOMA_COMMIT_ID # poor man's AppVersionedDoc record.app_version = settings.APP_VERSION record.original_app_version = settings.APP_VERSION record.save() couchlog_created.connect(add_bhoma_extras)