simplify encodings
This commit is contained in:
parent
d714bb9299
commit
9ca3ac3e49
1 changed files with 2 additions and 5 deletions
|
@ -38,18 +38,15 @@ class CustomEncoder(json.JSONEncoder):
|
||||||
class JsonFormatter(logging.Formatter):
|
class JsonFormatter(logging.Formatter):
|
||||||
|
|
||||||
def setup(self, timestamp, isWrite, targetFile, version, plugin):
|
def setup(self, timestamp, isWrite, targetFile, version, plugin):
|
||||||
encoding = sys.getfilesystemencoding()
|
|
||||||
|
|
||||||
self.timestamp = timestamp
|
self.timestamp = timestamp
|
||||||
self.isWrite = isWrite
|
self.isWrite = isWrite
|
||||||
self.targetFile = targetFile.decode(encoding, 'ignore')
|
self.targetFile = targetFile
|
||||||
self.version = version
|
self.version = version
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
|
|
||||||
def format(self, record):
|
def format(self, record):
|
||||||
now = self.formatTime(record, self.datefmt).decode('utf-8', 'ignore')
|
|
||||||
data = OrderedDict([
|
data = OrderedDict([
|
||||||
('now', now),
|
('now', self.formatTime(record, self.datefmt)),
|
||||||
('version', self.version),
|
('version', self.version),
|
||||||
('plugin', self.plugin),
|
('plugin', self.plugin),
|
||||||
('time', self.timestamp),
|
('time', self.timestamp),
|
||||||
|
|
Loading…
Reference in a new issue