Merge pull request #274 from cjmayo/python3_24

{python3_24} Python3: fix logger
This commit is contained in:
anarcat 2019-09-09 11:50:04 -04:00 committed by GitHub
commit 4e6c806bff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,6 +25,7 @@ import time
import codecs
import abc
from .. import log, LOG_CHECK, strformat, dummy, configuration, i18n
from builtins import str as str_text
_ = lambda x: x
Fields = dict(
@ -207,7 +208,7 @@ class _Logger (object):
def encode (self, s):
"""Encode string with output encoding."""
assert isinstance(s, unicode)
assert isinstance(s, str_text)
return s.encode(self.output_encoding, self.codec_errors)
def init_fileoutput (self, args):
@ -323,7 +324,7 @@ class _Logger (object):
"""
Write string to output descriptor plus a newline.
"""
self.write(u"%s%s" % (s, unicode(os.linesep)), **args)
self.write(u"%s%s" % (s, str_text(os.linesep)), **args)
def has_part (self, name):
"""