always turn strings into unicode in logger encoder
This commit is contained in:
parent
5bf2c063a5
commit
ce54ef0893
1 changed files with 2 additions and 2 deletions
|
@ -13,7 +13,7 @@ import logging
|
||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from .compat import u
|
from .compat import basestring, u
|
||||||
from .packages.requests.packages import urllib3
|
from .packages.requests.packages import urllib3
|
||||||
try:
|
try:
|
||||||
from collections import OrderedDict # pragma: nocover
|
from collections import OrderedDict # pragma: nocover
|
||||||
|
@ -28,7 +28,7 @@ except (ImportError, SyntaxError): # pragma: nocover
|
||||||
class CustomEncoder(json.JSONEncoder):
|
class CustomEncoder(json.JSONEncoder):
|
||||||
|
|
||||||
def default(self, obj):
|
def default(self, obj):
|
||||||
if isinstance(obj, bytes): # pragma: nocover
|
if isinstance(obj, basestring):
|
||||||
obj = u(obj)
|
obj = u(obj)
|
||||||
return json.dumps(obj)
|
return json.dumps(obj)
|
||||||
try: # pragma: nocover
|
try: # pragma: nocover
|
||||||
|
|
Loading…
Reference in a new issue