Fix logformat to use epoch timestamp in ms

This commit is contained in:
Matthias 2020-08-27 12:04:55 +02:00
parent bf5a082358
commit cf719bc5d3

View File

@ -640,10 +640,15 @@ class RPC:
else: else:
buffer = bufferHandler.buffer buffer = bufferHandler.buffer
records = [[datetime.fromtimestamp(r.created).strftime("%Y-%m-%d %H:%M:%S"), records = [[datetime.fromtimestamp(r.created).strftime("%Y-%m-%d %H:%M:%S"),
r.created, r.name, r.levelname, r.created * 1000, r.name, r.levelname,
r.message + ('\n' + r.exc_text if r.exc_text else '')] r.message + ('\n' + r.exc_text if r.exc_text else '')]
for r in buffer] for r in buffer]
# Logs format:
# [logtime-formatted, logepoch, logger-name, loglevel, message \n + exception]
# e.g. ["2020-08-27 11:35:01", 1598520901097.9397,
# "freqtrade.worker", "INFO", "Starting worker develop"]
return {'log_count': len(records), 'logs': records} return {'log_count': len(records), 'logs': records}
def _rpc_edge(self) -> List[Dict[str, Any]]: def _rpc_edge(self) -> List[Dict[str, Any]]: