wacom: change the raw log file name to include the timestamp
Because it's annoying when there's an issue with the timestamp in the file and you have to grep for the file name. And while we're there, change the human readable date to be actually readable. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
35acce3ea6
commit
bd6278a305
|
@ -209,14 +209,15 @@ class DataLogger(object):
|
|||
if self.logfile is not None:
|
||||
return
|
||||
|
||||
timestamp = time.strftime('%Y%m%d-%H%M%S')
|
||||
fname = f'log-{timestamp}.yaml'
|
||||
timestamp = int(time.time())
|
||||
t = time.strftime('%Y-%m-%d-%H:%M:%S')
|
||||
fname = f'log-{timestamp}-{t}.yaml'
|
||||
path = os.path.join(self.logdir, fname)
|
||||
self.logfile = open(path, 'w+')
|
||||
|
||||
self.logfile.write(f'name: {self.device.name}\n')
|
||||
self.logfile.write(f'bluetooth: {self.btaddr}\n')
|
||||
self.logfile.write(f'time: {int(time.time())} # host time: {time.strftime("%Y-%m-%d %H:%M:%S")}\n')
|
||||
self.logfile.write(f'time: {timestamp} # host time: {time.strftime("%Y-%m-%d %H:%M:%S")}\n')
|
||||
self.logfile.write(f'data:\n')
|
||||
|
||||
def _close_file(self):
|
||||
|
|
Loading…
Reference in New Issue