summaryrefslogtreecommitdiff
path: root/daemon/daemon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/daemon.cpp')
-rw-r--r--daemon/daemon.cpp34
1 files changed, 10 insertions, 24 deletions
diff --git a/daemon/daemon.cpp b/daemon/daemon.cpp
index b745e5c..178f04d 100644
--- a/daemon/daemon.cpp
+++ b/daemon/daemon.cpp
@@ -34,8 +34,7 @@
#include <QFile>
#include <QDir>
#include <QFileInfo>
-#include <Log4Qt/LogManager>
-#include <Log4Qt/PropertyConfigurator>
+#include <QLoggingCategory>
void signalhandler(int sig)
{
@@ -49,34 +48,21 @@ void signalhandler(int sig)
}
}
-void initLogging()
-{
- // Sailfish OS-specific locations for the app settings files and app's own files
- const QString logConfigFilePath(QStandardPaths::standardLocations(QStandardPaths::ConfigLocation).at(0)
- + "pebble/log4qt.conf");
- const QString fallbackLogConfigPath("/usr/share/pebble/log4qt.conf");
-
- const QString& usedConfigFile = QFile::exists(logConfigFilePath) ? logConfigFilePath : fallbackLogConfigPath;
- Log4Qt::PropertyConfigurator::configure(usedConfigFile);
-
- // For capturing qDebug() and console.log() messages
- // Note that console.log() might fail in Sailfish OS device builds. Not sure why, but it seems like
- // console.log() exactly in Sailfish OS device release builds doesn't go through the same qDebug() channel
- Log4Qt::LogManager::setHandleQtMessages(true);
-
- qDebug() << "Using following log config file:" << usedConfigFile;
-}
-
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
app.setApplicationName("pebble"); // Use the same appname as the UI.
- // Init logging should be called after app object creation as initLogging() will examine
- // QCoreApplication for determining the .conf files locations
- initLogging();
+ QStringList filterRules;
+
+ filterRules << (argc > 1 and QString("-d") == argv[0] ?
+ "*.debug=false" : "*.debug=true");
+
+ // Init logging should be called after app object creation
+ QLoggingCategory::setFilterRules(filterRules.join("\n"));
- Log4Qt::Logger::logger(QLatin1String("Main Logger"))->info() << argv[0] << APP_VERSION;
+ QLoggingCategory l("main");
+ qCDebug(l) << argv[0] << APP_VERSION;
Settings settings;
Manager manager(&settings);