summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseniy-Movshev <dodoradio@outlook.com>2023-05-28 14:36:42 +0100
committerArseniy-Movshev <dodoradio@outlook.com>2023-05-28 21:37:43 +0100
commit580f53c0fd69468f5867a2e4c8bb80b031540643 (patch)
tree2fefade842e4f7b9fdffc5e6fb98fbc329478415
parente228f65119bef5ba2e0a26c0f9c53d5c3f131463 (diff)
Make the log path configurable
This also renames it to sensorlogd from the obsolete asteroid-healthtracker and hides it by default
Diffstat (limited to '')
-rw-r--r--daemon/logger.cpp8
-rw-r--r--qmlplugin/loggerSettings.cpp1
-rw-r--r--qmlplugin/stepsDataLoader.cpp4
3 files changed, 8 insertions, 5 deletions
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 <QFile>
#include <QDir>
#include <QTextStream>
-#include <QStandardPaths>
#include <QTimer>
#include <QDebug>
+#include <QStandardPaths>
#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);
}
diff --git a/qmlplugin/loggerSettings.cpp b/qmlplugin/loggerSettings.cpp
index c03c3c9..58bd4b9 100644
--- a/qmlplugin/loggerSettings.cpp
+++ b/qmlplugin/loggerSettings.cpp
@@ -9,7 +9,6 @@
*/
#include <QDebug>
-#include <QStandardPaths>
#include "loggerSettings.h"
diff --git a/qmlplugin/stepsDataLoader.cpp b/qmlplugin/stepsDataLoader.cpp
index cf072c3..0c084ea 100644
--- a/qmlplugin/stepsDataLoader.cpp
+++ b/qmlplugin/stepsDataLoader.cpp
@@ -12,6 +12,7 @@
#include <QFile>
#include <QTextStream>
#include <QDate>
+#include <QSettings>
#include <QStandardPaths>
#include "stepsDataLoader.h"
@@ -45,5 +46,6 @@ int StepsDataLoader::getDataForDate(QDate date) { // This is obvious garbage. Th
}
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");
}