Skip to content

Commit

Permalink
Revert "Message body needs to be json"
Browse files Browse the repository at this point in the history
  • Loading branch information
fbarreir committed Nov 30, 2015
1 parent b5fd6c2 commit 078fc8e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
9 changes: 4 additions & 5 deletions pandacommon/pandalogger/PandaLogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def run(self):
h.putrequest(self.method, url)
if self.method == "POST":
h.putheader("Content-length", str(len(self.data)))
h.putheader ("Content-type", "application/json; charset=UTF-8")
h.endheaders()
h.endheaders()
if self.method == "POST":
h.send(self.data)
response = h.getresponse() # can't do anything with the result
#for s in self.getData(response, 1024):
Expand Down Expand Up @@ -115,7 +115,7 @@ def mapLogRecord(self, record):
"""
Default implementation of mapping the log record into a dict
that is sent as the CGI data. Overwrite in your class.
Contributed by Franz Glasner.
Contributed by Franz Glasner.
"""
newrec = record.__dict__
for p in self.params:
Expand Down Expand Up @@ -143,10 +143,9 @@ def emit(self, record):
# The new logger needs to be json encoded and use POST method

if self.encoding == JSON:

arr=[{
"headers":{"timestamp" : int(time.time())*1000, "host" : "%s:%s"%(self.url, self.port)},
"body": "{0}".format(json.dumps(self.mapLogRecord(record)))
"body": "%s"%self.mapLogRecord(record)
}]
data = json.dumps(arr)
else:
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def run (self):
# remove build/*/dump for bdist
patt = re.sub('build/[^/]+/dumb','',patt)
# remove /var/tmp/*-buildroot for bdist_rpm
patt = re.sub('/var/tmp/.*-buildroot','',patt)
patt = re.sub('/var/tmp/.*-buildroot','',patt)
# replace
filedata = filedata.replace('@@%s@@' % item, patt)
# write to dest
Expand Down Expand Up @@ -99,7 +99,6 @@ def run (self):
'pandacommon.liveconfigparser',
'pandacommon.pandalogger',
'pandacommon.pandautils',
'pandacommon.test',
],
data_files=[
('/etc/panda',
Expand Down

0 comments on commit 078fc8e

Please sign in to comment.