add an 'encoding' option for logging files (default 'utf-8')

pull/133/head
Mike Fährmann 6 years ago
parent 513d807632
commit b08d95ebe4
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -57,9 +57,10 @@ def setup_logging_handler(key, fmt=LOG_FORMAT, lvl=LOG_LEVEL):
path = opts.get("path")
mode = opts.get("mode", "w")
encoding = opts.get("encoding", "utf-8")
try:
path = util.expand_path(path)
handler = logging.FileHandler(path, mode)
handler = logging.FileHandler(path, mode, encoding)
except (OSError, ValueError) as exc:
log.warning("%s: %s", key, exc)
return None

Loading…
Cancel
Save