File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 2121except ImportError :
2222 AWS4AUTH_SUPPORTED = False
2323
24- from serializers import CMRESSerializer
24+ from cmreslogging . serializers import CMRESSerializer
2525
2626
2727class CMRESHandler (logging .Handler ):
Original file line number Diff line number Diff line change 55
66from elasticsearch .serializer import JSONSerializer
77
8+
89class CMRESSerializer (JSONSerializer ):
9- """ JSON serializer inherited from the elastic search JSON serializer
10+ """ JSON serializer inherited from the elastic search JSON serializer
1011
1112 Allows to serialize logs for a elasticsearch use.
1213 Manage the record.exc_info containing an exception type.
1314 """
1415 def default (self , data ):
1516 """ Default overrides the elasticsearch default method
1617
17- Allows to transform unknown types into strings
18-
19- :params data: The data to serialize before sending it to elastic search
18+ Allows to transform unknown types into strings
19+
20+ :params data: The data to serialize before sending it to elastic search
2021 """
22+ result = None
2123 if isinstance (data , (date , datetime )):
22- return data .isoformat ()
24+ result = data .isoformat ()
2325 elif isinstance (data , Decimal ):
24- return float (data )
26+ result = float (data )
2527 else :
26- return str (data )
28+ result = str (data )
29+ return result
You can’t perform that action at this time.
0 commit comments