Skip to content

Commit 2d43e96

Browse files
author
mbirger
committed
Fix logging of non-serializable object (Python 2)
Direct call of __repr__ method causes Python failure in Python 2. Actual code works only in Python 3. repr() call works in both Python 2/3.
1 parent 5b11195 commit 2d43e96

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kafka_logger/handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def prepare_record_dict(self, record):
160160
# Elasticsearch supports number datatypes
161161
# but it is not 1:1 - logging "inf" float
162162
# causes _jsonparsefailure error in ELK
163-
value = tuple(arg.__repr__() for arg in value)
163+
value = tuple(repr(arg) for arg in value)
164164
rec[key] = "" if value is None else value
165165

166166
return rec

0 commit comments

Comments
 (0)