Skip to content
This repository was archived by the owner on Apr 3, 2023. It is now read-only.

Commit 0a10583

Browse files
oschulzSamgkreuzer
authored andcommitted
adjust unit test, fixed bug
1 parent 4dd40ff commit 0a10583

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

logstash_async/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Constants:
2727
FORMATTER_RECORD_FIELD_SKIP_LIST = [
2828
'args', 'asctime', 'created', 'exc_info', 'exc_text', 'filename', 'funcName',
2929
'id', 'levelname', 'levelno', 'lineno', 'message','module',
30-
'msecs', 'msg', 'pathname', 'process',
30+
'msecs', 'msg', 'name', 'pathname', 'process',
3131
'processName', 'relativeCreated', 'stack_info', 'thread', 'threadName']
3232
# fields to be set on the top-level of a Logstash event/message, do not modify this
3333
# unless you know what you are doing

logstash_async/formatter.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,8 @@ def format(self, record):
100100
message.update(dynamic_extra_fields)
101101
# prepare static extra fields
102102
self._format_extra_fields()
103-
message.update(self._extra)
104-
# remove all fields to be excluded
105-
106-
# move existing extra record fields into the configured prefix
107-
# self._move_extra_record_fields_to_prefix(message)
103+
if self._extra:
104+
message.update(self._extra)
108105

109106
return self._serialize(message)
110107

@@ -128,6 +125,7 @@ def value_repr(value):
128125
elif isinstance(value, uuid.UUID):
129126
return value.hex
130127
elif isinstance(value, easy_types):
128+
131129
return value
132130
else:
133131
return repr(value)

tests/formatter_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def handleError(self, record):
2323
class LogstashFormatterTest(unittest.TestCase):
2424
def test_format(self):
2525
file_handler = ExceptionCatchingFileHandler(os.devnull)
26-
file_handler.setFormatter(LogstashFormatter(ensure_ascii=False))
26+
file_handler.setFormatter(LogstashFormatter())
2727
file_handler.emit(makeLogRecord({"msg": u"тест"}))
2828
file_handler.close()
2929

0 commit comments

Comments
 (0)