From 51174a59a997359c6597eb957fb3209479b275d0 Mon Sep 17 00:00:00 2001 From: robertoszek Date: Sat, 12 Feb 2022 19:17:36 +0100 Subject: [PATCH] fix logger for non-utf-8 encodings --- pleroma_bot/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pleroma_bot/__init__.py b/pleroma_bot/__init__.py index 8eb5210..a5db815 100644 --- a/pleroma_bot/__init__.py +++ b/pleroma_bot/__init__.py @@ -23,7 +23,7 @@ class CustomFormatter(logging.Formatter): "(%(filename)s:%(lineno)d) " ) - if sys.platform != "win32": + if sys.platform != "win32" and sys.stdout.encoding == 'utf-8': FORMATS = { logging.DEBUG: grey + format_r + reset, logging.INFO: grey + "ℹ " + format_r + reset,