mirror of
https://github.com/meshtastic/python.git
synced 2025-12-27 01:47:50 -05:00
keep a symbolic link "latest" that points to the latest slog dir
This commit is contained in:
@@ -152,6 +152,13 @@ class LogSet:
|
||||
app_dir = platformdirs.user_data_dir(app_name, app_author)
|
||||
dir_name = f"{app_dir}/slogs/{datetime.now().strftime('%Y%m%d-%H%M%S')}"
|
||||
os.makedirs(dir_name, exist_ok=True)
|
||||
|
||||
# Also make a 'latest' directory that always points to the most recent logs
|
||||
# symlink might fail on some platforms, if it does fail silently
|
||||
if os.path.exists(f"{app_dir}/slogs/latest"):
|
||||
os.unlink(f"{app_dir}/slogs/latest")
|
||||
os.symlink(dir_name, f"{app_dir}/slogs/latest", target_is_directory=True)
|
||||
|
||||
self.dir_name = dir_name
|
||||
|
||||
logging.info(f"Writing slogs to {dir_name}")
|
||||
|
||||
Reference in New Issue
Block a user