From 580f53c0fd69468f5867a2e4c8bb80b031540643 Mon Sep 17 00:00:00 2001 From: Arseniy-Movshev Date: Sun, 28 May 2023 14:36:42 +0100 Subject: Make the log path configurable This also renames it to sensorlogd from the obsolete asteroid-healthtracker and hides it by default --- daemon/logger.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'daemon') diff --git a/daemon/logger.cpp b/daemon/logger.cpp index 7222c95..984ae33 100644 --- a/daemon/logger.cpp +++ b/daemon/logger.cpp @@ -16,9 +16,9 @@ #include #include #include -#include #include #include +#include #include "logger.h" @@ -115,10 +115,12 @@ QStringList fileGetPrevRecord(QString sensorPrefix, QDateTime recordTime) { } QString fileNameForDate(QDate date, QString prefix) { - return QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/asteroid-healthloggerd/" + prefix + "/" + date.toString("yyyy-MM-dd.log"); + QSettings settings("asteroid","sensorlogd"); //this should be moved out of here at some point TODO + return settings.value("loggerRootPath",QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.asteroid-sensorlogd/").toString() + prefix + "/" + date.toString("yyyy-MM-dd.log"); } void setupFilePath(QString sensorPrefix) { - QDir().mkpath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/asteroid-healthloggerd/" + sensorPrefix); + QSettings settings("asteroid","sensorlogd"); //this should be moved out of here at some point TODO + QDir::root().mkpath(settings.value("loggerRootPath",QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.asteroid-sensorlogd/").toString() + sensorPrefix); } -- cgit v1.2.3-70-g09d2