Store the raw logs in the specified config dir too

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2019-08-22 16:45:48 +10:00
parent d514aa2224
commit cdb7f905ca
2 changed files with 8 additions and 3 deletions

View File

@ -44,6 +44,13 @@ class TuhiConfig(GObject.Object):
self.peek_at_drawing = False
return cls._instance
@property
def log_dir(self):
'''
The pathlib.Path to the directory to store log files in.
'''
return Path(self._base_path)
@GObject.Property
def devices(self):
'''

View File

@ -169,12 +169,10 @@ class DataLogger(object):
}
def __init__(self, bluez_device):
import xdg.BaseDirectory
self.logger = logging.getLogger('tuhi.fw')
self.device = bluez_device
self.btaddr = bluez_device.address
self.logdir = Path(xdg.BaseDirectory.xdg_data_home, 'tuhi', self.btaddr, 'raw')
self.logdir = Path(TuhiConfig().log_dir, self.btaddr, 'raw')
self.logdir.mkdir(parents=True, exist_ok=True)
bluez_device.connect('connected', self._on_bluez_connected)