aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2020-04-09 18:31:55 +0200
committerGravatar Numerlor <[email protected]>2020-04-09 20:28:09 +0200
commit4ac17f806c2f9d98503067dbd181ae2a839bc74c (patch)
treeccd94aef33925dfbe4b77deb15fc7fa26623d273
parentDelete channel from claimant cache. (diff)
Specify encoding to logging file handler.
With the new addition of non latin-11 chars in channel names - which get logged, the logging to files fails on those entries on OSs where the default encoding is not utf8 or an other encoding capable of handling them.
-rw-r--r--bot/__init__.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/bot/__init__.py b/bot/__init__.py
index c9dbc3f40..2dd4af225 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -33,7 +33,7 @@ log_format = logging.Formatter(format_string)
log_file = Path("logs", "bot.log")
log_file.parent.mkdir(exist_ok=True)
-file_handler = handlers.RotatingFileHandler(log_file, maxBytes=5242880, backupCount=7)
+file_handler = handlers.RotatingFileHandler(log_file, maxBytes=5242880, backupCount=7, encoding="utf8")
file_handler.setFormatter(log_format)
root_log = logging.getLogger()