Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Add configuration of extra_fields #8

Merged
merged 1 commit into from over 2 years ago

2 participants

Colin Howe Sever Băneșiu
Colin Howe

Fixes issue #7

Sever Băneșiu
Owner

Thanks for contributing this, can you please update the documentation to reflect this additional flag?
Please include specific references to logbook and how it breaks if the flag is set to True.

Sever Băneșiu severb merged commit 833b479 into from
Sever Băneșiu severb closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Feb 21, 2012
Colin Howe colinhowe Make additional of extra fields configurable f6754d4
This page is out of date. Refresh to see the latest.

Showing 2 changed files with 7 additions and 3 deletions. Show diff stats Hide diff stats

  1. +6 2 graypy/handler.py
  2. +1 1  setup.py
8 graypy/handler.py
@@ -12,8 +12,10 @@
12 12
13 13
14 14 class GELFHandler(DatagramHandler):
15   - def __init__(self, host, port, chunk_size=WAN_CHUNK, debugging_fields=True):
  15 + def __init__(self, host, port, chunk_size=WAN_CHUNK, debugging_fields=True,
  16 + extra_fields=True):
16 17 self.debugging_fields = debugging_fields
  18 + self.extra_fields = extra_fields
17 19 self.chunk_size = chunk_size
18 20 DatagramHandler.__init__(self, host, port)
19 21
@@ -61,7 +63,9 @@ def make_message_dict(self, record):
61 63 pn = getattr(record, 'processName', None)
62 64 if pn is not None:
63 65 fields['_process_name'] = pn
64   - return self.add_extra_fields(fields, record)
  66 + if self.extra_fields:
  67 + fields = self.add_extra_fields(fields, record)
  68 + return fields
65 69
66 70 def add_extra_fields(self, message_dict, record):
67 71 # skip_list is used to filter additional fields in a log message.
2  setup.py
@@ -5,7 +5,7 @@
5 5 setup(
6 6
7 7 name='graypy',
8   - version='0.2.3',
  8 + version='0.2.4',
9 9 description="Python logging handler that sends messages in GELF (Graylog Extended Log Format).",
10 10 long_description=open('README.rst').read(),
11 11 keywords='logging gelf graylog2 graylog udp',

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.