mirror of
https://github.com/wakatime/sublime-wakatime.git
synced 2023-08-10 21:13:02 +03:00
fixed bug in custom logger where calling super() on old-style class throws exception.
This commit is contained in:
parent
eb1e3f72db
commit
8640a43160
@ -27,15 +27,13 @@ class CustomEncoder(json.JSONEncoder):
|
|||||||
|
|
||||||
class JsonFormatter(logging.Formatter):
|
class JsonFormatter(logging.Formatter):
|
||||||
|
|
||||||
def __init__(self, timestamp, endtime, isWrite, targetFile, version,
|
def setup(self, timestamp, endtime, isWrite, targetFile, version, plugin):
|
||||||
plugin, datefmt=None):
|
|
||||||
self.timestamp = timestamp
|
self.timestamp = timestamp
|
||||||
self.endtime = endtime
|
self.endtime = endtime
|
||||||
self.isWrite = isWrite
|
self.isWrite = isWrite
|
||||||
self.targetFile = targetFile
|
self.targetFile = targetFile
|
||||||
self.version = version
|
self.version = version
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
super(JsonFormatter, self).__init__(datefmt=datefmt)
|
|
||||||
|
|
||||||
def format(self, record):
|
def format(self, record):
|
||||||
data = OrderedDict([
|
data = OrderedDict([
|
||||||
@ -66,14 +64,14 @@ def setup_logging(args, version):
|
|||||||
if not logfile:
|
if not logfile:
|
||||||
logfile = '~/.wakatime.log'
|
logfile = '~/.wakatime.log'
|
||||||
handler = logging.FileHandler(os.path.expanduser(logfile))
|
handler = logging.FileHandler(os.path.expanduser(logfile))
|
||||||
formatter = JsonFormatter(
|
formatter = JsonFormatter(datefmt='%Y-%m-%dT%H:%M:%SZ')
|
||||||
|
formatter.setup(
|
||||||
timestamp=args.timestamp,
|
timestamp=args.timestamp,
|
||||||
endtime=args.endtime,
|
endtime=args.endtime,
|
||||||
isWrite=args.isWrite,
|
isWrite=args.isWrite,
|
||||||
targetFile=args.targetFile,
|
targetFile=args.targetFile,
|
||||||
version=version,
|
version=version,
|
||||||
plugin=args.plugin,
|
plugin=args.plugin,
|
||||||
datefmt='%Y-%m-%dT%H:%M:%SZ',
|
|
||||||
)
|
)
|
||||||
handler.setFormatter(formatter)
|
handler.setFormatter(formatter)
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
Loading…
Reference in New Issue
Block a user