Skip to content

Commit f377ca8

Browse files
authored
Always use UTF-8 for log file encoding (#247)
1 parent 50d30cf commit f377ca8

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

HISTORY.rst

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
Release History
44
===============
55

6+
0.8.2
7+
+++++
8+
9+
* Always use UTF-8 for log file encoding (#247)
10+
611
0.8.1
712
+++++
813

knack/log.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
# without --debug flag.
1717
cli_logger_names = [CLI_LOGGER_NAME]
1818

19+
LOG_FILE_ENCODING = 'utf-8'
20+
1921

2022
class CliLogLevel(IntEnum):
2123
CRITICAL = 0
@@ -163,7 +165,8 @@ def _init_logfile_handlers(self, root_logger, cli_loggers):
163165
ensure_dir(self.log_dir)
164166
log_file_path = os.path.join(self.log_dir, self.logfile_name)
165167
from logging.handlers import RotatingFileHandler
166-
logfile_handler = RotatingFileHandler(log_file_path, maxBytes=10 * 1024 * 1024, backupCount=5)
168+
logfile_handler = RotatingFileHandler(log_file_path, maxBytes=10 * 1024 * 1024, backupCount=5,
169+
encoding=LOG_FILE_ENCODING)
167170
lfmt = logging.Formatter('%(process)d : %(asctime)s : %(levelname)s : %(name)s : %(message)s')
168171
logfile_handler.setFormatter(lfmt)
169172
logfile_handler.setLevel(logging.DEBUG)

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from codecs import open
99
from setuptools import setup, find_packages
1010

11-
VERSION = '0.8.1'
11+
VERSION = '0.8.2'
1212

1313
DEPENDENCIES = [
1414
'argcomplete',

0 commit comments

Comments
 (0)