Skip to content

Commit ad500d6

Browse files
committed
Added a formatter
1 parent fd426c1 commit ad500d6

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

logstash/formatter.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import traceback
21
import logging
32
import socket
43
import sys
4+
import traceback
55
from datetime import datetime
66

77
try:
@@ -140,3 +140,10 @@ def format(self, record):
140140
message.update(self.get_debug_fields(record))
141141

142142
return self.serialize(message)
143+
144+
145+
# Added to get serialized strings instead of bytes
146+
class LogstashFormatterVersion2(LogstashFormatterVersion1):
147+
@classmethod
148+
def serialize(cls, message):
149+
return json.dumps(message)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
setup(
33
name='python-logstash',
44
packages=['logstash'],
5-
version='0.4.7',
5+
version='0.4.8',
66
description='Python logging handler for Logstash.',
77
long_description=open('README.rst').read(),
88
license='MIT',

0 commit comments

Comments
 (0)