@@ -90,6 +90,8 @@ def __init__(self, *args, **kwargs):
90
90
that will be used to customize the indent of the output json.
91
91
:param prefix: an optional string prefix added at the beginning of
92
92
the formatted string
93
+ :param json_indent: indent parameter for json.dumps
94
+ :param json_ensure_ascii: ensure_ascii parameter for json.dumps
93
95
:param reserved_attrs: an optional list of fields that will be skipped when
94
96
outputting json log record. Defaults to all log record attributes:
95
97
http://docs.python.org/library/logging.html#logrecord-attributes
@@ -102,6 +104,7 @@ def __init__(self, *args, **kwargs):
102
104
self .json_encoder = kwargs .pop ("json_encoder" , None )
103
105
self .json_serializer = kwargs .pop ("json_serializer" , json .dumps )
104
106
self .json_indent = kwargs .pop ("json_indent" , None )
107
+ self .json_ensure_ascii = kwargs .pop ("json_ensure_ascii" , True )
105
108
self .prefix = kwargs .pop ("prefix" , "" )
106
109
reserved_attrs = kwargs .pop ("reserved_attrs" , RESERVED_ATTRS )
107
110
self .reserved_attrs = dict (zip (reserved_attrs , reserved_attrs ))
@@ -152,7 +155,8 @@ def jsonify_log_record(self, log_record):
152
155
return self .json_serializer (log_record ,
153
156
default = self .json_default ,
154
157
cls = self .json_encoder ,
155
- indent = self .json_indent )
158
+ indent = self .json_indent ,
159
+ ensure_ascii = self .json_ensure_ascii )
156
160
157
161
def format (self , record ):
158
162
"""Formats a log record and serializes to json"""
0 commit comments