add guhsettings for log path
This commit is contained in:
parent
85f6b441c9
commit
5d91331683
@ -121,11 +121,11 @@ QString GuhSettings::logPath()
|
|||||||
QString organisationName = QCoreApplication::instance()->organizationName();
|
QString organisationName = QCoreApplication::instance()->organizationName();
|
||||||
|
|
||||||
if (organisationName == "guh-test") {
|
if (organisationName == "guh-test") {
|
||||||
logPath = QDir::homePath() + ".config/" + organisationName + "/guhd-test.log";
|
logPath = "/tmp/guhd-test.log";
|
||||||
} else if (GuhSettings::isRoot()) {
|
} else if (GuhSettings::isRoot()) {
|
||||||
logPath = "/var/log/guhd.log";
|
logPath = "/var/log/guhd.log";
|
||||||
} else {
|
} else {
|
||||||
logPath = QDir::homePath() + ".config/" + organisationName + "/guhd.log";
|
logPath = QDir::homePath() + "/.config/" + organisationName + "/guhd.log";
|
||||||
}
|
}
|
||||||
|
|
||||||
return logPath;
|
return logPath;
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
* *
|
* *
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
#include "guhsettings.h"
|
||||||
#include "logengine.h"
|
#include "logengine.h"
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
@ -41,7 +42,9 @@ LogEngine::LogEngine(QObject *parent):
|
|||||||
{
|
{
|
||||||
|
|
||||||
m_db = QSqlDatabase::addDatabase("QSQLITE");
|
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()) {
|
if (!m_db.isValid()) {
|
||||||
qCWarning(dcLogEngine) << "Database not valid:" << m_db.lastError().driverText() << m_db.lastError().databaseText();
|
qCWarning(dcLogEngine) << "Database not valid:" << m_db.lastError().driverText() << m_db.lastError().databaseText();
|
||||||
|
|||||||
Reference in New Issue
Block a user