diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index bdf7f135..d977652d 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -187,9 +187,9 @@ jobs: -vv # macOS-latest + CPython completes in 9-15s # macOS-11.0 + CPython completes in 8s-12s - # ubuntu-16.04 + CPython completes in 8s-13s + # ubuntu-16.04 + CPython completes in 8s-2m12s # ubuntu-16.04 + PyPy completes in 13s-16s - # ubuntu-18.04 + CPython completes in 8s-13s + # ubuntu-18.04 + CPython completes in 8s-2m12s # ubuntu-18.04 + PyPy completes in 13s-15s # ubuntu-20.04 + CPython completes in 8s-14s # ubuntu-20.04 + PyPy completes in 13s-16s @@ -197,7 +197,7 @@ jobs: # windows-latest + PyPy completes in 13s-24s # windows-2016 + CPython completes in 7s-11s # windows-2016 + PyPy completes in 13s-20s - timeout-minutes: 2 + timeout-minutes: 3 - name: Dump test logs on failure if: failure() shell: bash diff --git a/magicbus/plugins/loggers.py b/magicbus/plugins/loggers.py index bab3c12b..f71c9cd2 100644 --- a/magicbus/plugins/loggers.py +++ b/magicbus/plugins/loggers.py @@ -30,6 +30,9 @@ def log(self, msg, level): if self.encoding is not None: if isinstance(complete_msg, unicodestr): complete_msg = complete_msg.encode(self.encoding) + else: + if not isinstance(complete_msg, unicodestr): + complete_msg = complete_msg.decode("utf-8") self.stream.write(complete_msg) self.stream.flush() @@ -37,13 +40,13 @@ def log(self, msg, level): class StdoutLogger(StreamLogger): - def __init__(self, bus, level=None, format=None, encoding='utf-8'): + def __init__(self, bus, level=None, format=None, encoding=None): StreamLogger.__init__(self, bus, sys.stdout, level, format, encoding) class StderrLogger(StreamLogger): - def __init__(self, bus, level=None, format=None, encoding='utf-8'): + def __init__(self, bus, level=None, format=None, encoding=None): StreamLogger.__init__(self, bus, sys.stderr, level, format, encoding)