add guhsettings for log path

pull/135/head
Simon Stürz 2015-07-08 14:48:19 +02:00 committed by Michael Zanetti
parent 85f6b441c9
commit 5d91331683
2 changed files with 6 additions and 3 deletions

View File

@ -121,11 +121,11 @@ QString GuhSettings::logPath()
QString organisationName = QCoreApplication::instance()->organizationName();
if (organisationName == "guh-test") {
logPath = QDir::homePath() + ".config/" + organisationName + "/guhd-test.log";
logPath = "/tmp/guhd-test.log";
} else if (GuhSettings::isRoot()) {
logPath = "/var/log/guhd.log";
} else {
logPath = QDir::homePath() + ".config/" + organisationName + "/guhd.log";
logPath = QDir::homePath() + "/.config/" + organisationName + "/guhd.log";
}
return logPath;

View File

@ -19,6 +19,7 @@
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "guhsettings.h"
#include "logengine.h"
#include "loggingcategories.h"
#include "logging.h"
@ -41,7 +42,9 @@ LogEngine::LogEngine(QObject *parent):
{
m_db = QSqlDatabase::addDatabase("QSQLITE");
m_db.setDatabaseName("/tmp/guhd.log");
m_db.setDatabaseName(GuhSettings::logPath());
qCDebug(dcLogEngine) << "Opening logging database" << m_db.databaseName();
if (!m_db.isValid()) {
qCWarning(dcLogEngine) << "Database not valid:" << m_db.lastError().driverText() << m_db.lastError().databaseText();