Merge "Drop logic for old python versions"
This commit is contained in:
commit
5bf57caed7
@ -75,11 +75,7 @@ def main():
|
||||
# non-buffered behaviour. on python3, sys.stdin was
|
||||
# opened with the system encoding and made the line into
|
||||
# utf-8, so write the logfile out in utf-8 bytes.
|
||||
if sys.version_info < (3,):
|
||||
outfile.write(ts_line)
|
||||
else:
|
||||
outfile.write(
|
||||
ts_line.encode('utf-8', errors='surrogateescape'))
|
||||
outfile.write(ts_line.encode('utf-8', errors='surrogateescape'))
|
||||
outfile.flush()
|
||||
|
||||
|
||||
|
@ -26,7 +26,6 @@ import json
|
||||
import logging
|
||||
import logging.config
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
# A simple formatter to more or less copy oslo.log's ContextFormatter
|
||||
@ -43,11 +42,8 @@ class DibFormatter(logging.Formatter):
|
||||
else:
|
||||
fmt = self.fmt
|
||||
|
||||
if sys.version_info < (3, 2):
|
||||
self._fmt = fmt
|
||||
else:
|
||||
self._style = logging.PercentStyle(fmt)
|
||||
self._fmt = self._style._fmt
|
||||
self._style = logging.PercentStyle(fmt)
|
||||
self._fmt = self._style._fmt
|
||||
|
||||
return logging.Formatter.format(self, record)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user