mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-17 11:22:28 +12:00
Write log file in UTF-8 to fix encoding errors
Some log messages use characters in the Unicode character set that aren't typically represented in the older encodings. One such example was the messages that happen when renaming an item and saving the project. Positive note though: errors while logging might not end up in the log file when the log file is the cause, but they still showed on the terminal with excessive detail. Also, despite the exceptions and errors, the project I was testing successfully completed its saving procedures as a subsequent reload showed. I am personally quite happy with the degree of thought and care put into the Python logging system. :-)
This commit is contained in:
parent
c797b5a18b
commit
0910246899
|
@ -59,7 +59,7 @@ def logToFile(file_level=logging.DEBUG, logfile=None):
|
|||
# log files may not be in our users best interest for the time
|
||||
# being. (Unfortunately.)
|
||||
try:
|
||||
fh = logging.FileHandler(logfile, mode='w')
|
||||
fh = logging.FileHandler(logfile, mode='w', encoding='utf-8')
|
||||
fh.setLevel(file_level)
|
||||
fh.setFormatter(logging.Formatter(LOGFORMAT_FILE))
|
||||
|
||||
|
|
Loading…
Reference in a new issue