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>
pull/160/head
Peter Hutterer 2019-08-15 14:41:40 +10:00
parent 35acce3ea6
commit bd6278a305
1 changed files with 4 additions and 3 deletions

View File

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