Skip to content

Instantly share code, notes, and snippets.

@chrcoe
Created March 9, 2016 16:20
Show Gist options
  • Save chrcoe/3ec863bcd26d34126d06 to your computer and use it in GitHub Desktop.
Save chrcoe/3ec863bcd26d34126d06 to your computer and use it in GitHub Desktop.
in order to override the graypy version number, you need to use a filter which takes in the record... then override the version attribute:
def filter(self, record):
added_fields = dict(record.args)
record.version = APP_VERSION # dynamically generated at module level
record.company_name = added_fields.get('company_name', None)
# add whatever data fields here we want to search by
# record.does_not_exist = "DOES NOT EXIST TEST"
return True
however, graypy will only look at the record if there is an attribute which is NOT one of the standard GELF format attributes such as version.
if you want to update the version, you need to pass a non-standard attribute:
def filter(self, record):
added_fields = dict(record.args)
record.version = APP_VERSION # dynamically generated at module level
record.company_name = added_fields.get('company_name', None)
# add whatever data fields here we want to search by
record.does_not_exist = "DOES NOT EXIST TEST"
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment