simplify encodings

This commit is contained in:
Alan Hamlett 2013-12-03 02:36:52 +01:00
parent d714bb9299
commit 9ca3ac3e49

View file

@ -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),