@@ -27,6 +27,11 @@
2727#define SYSTEMIMAGE_PATH QStringLiteral("/Service")
2828#define SYSTEMIMAGE_IFACE QStringLiteral("com.canonical.SystemImage")
2929
30+Q_LOGGING_CATEGORY(SYSTEMIMAGEPLUGIN, "unity8.systemimage", QtWarningMsg)
31+
32+#define DEBUG_MSG qCDebug(SYSTEMIMAGEPLUGIN).nospace().noquote() << Q_FUNC_INFO
33+#define WARNING_MSG qCWarning(SYSTEMIMAGEPLUGIN).nospace().noquote() << Q_FUNC_INFO
34+
3035SystemImage::SystemImage(QObject *parent)
3136 : QObject(parent)
3237{
@@ -44,7 +49,7 @@ SystemImage::SystemImage(QObject *parent)
4449
4550void SystemImage::checkForUpdate()
4651{
47− qDebug() << "!!! Checking for update";
52+ DEBUG_MSG << "Checking for update";
4853 const QDBusMessage msg = QDBusMessage::createMethodCall(SYSTEMIMAGE_SERVICE, SYSTEMIMAGE_PATH, SYSTEMIMAGE_IFACE,
4954 QStringLiteral("CheckForUpdate"));
5055 QDBusConnection::systemBus().asyncCall(msg);
@@ -52,7 +57,7 @@ void SystemImage::checkForUpdate()
5257
5358void SystemImage::applyUpdate()
5459{
55− qDebug() << "!!! Applying update";
60+ DEBUG_MSG << "Applying update";
5661 setUpdateApplying(true);
5762
5863 const QDBusMessage msg = QDBusMessage::createMethodCall(SYSTEMIMAGE_SERVICE, SYSTEMIMAGE_PATH, SYSTEMIMAGE_IFACE,
@@ -70,7 +75,7 @@ void SystemImage::factoryReset()
7075void SystemImage::onUpdateAvailableStatus(bool is_available, bool downloading, const QString &available_version, int update_size,
7176 const QString &last_update_date, const QString &error_reason)
7277{
73− qDebug() << Q_FUNC_INFO << "A new update is" << (is_available ? "" : "NOT") << "available";
78+ DEBUG_MSG << "A new update is " << (is_available ? "" : "NOT") << "available";
7479
7580 if (is_available == m_updateAvailable) {
7681 return;
@@ -84,13 +89,13 @@ void SystemImage::onUpdateAvailableStatus(bool is_available, bool downloading, c
8489 m_errorReason = error_reason;
8590 Q_EMIT updateAvailableStatus();
8691
87− qDebug() << "!!! Downloading:" << downloading << ", version:" << available_version << ", last update:" << last_update_date <<
88− ", size:" << m_updateSize;
92+ DEBUG_MSG << "Downloading: " << downloading << ", version: " << available_version << ", last update: " << last_update_date <<
93+ ", size: " << m_updateSize;
8994}
9095
9196void SystemImage::onUpdateDownloaded()
9297{
93− qDebug() << "!!! Update downloaded";
98+ DEBUG_MSG << "Update downloaded";
9499
95100 m_downloaded = true;
96101 Q_EMIT updateDownloadedChanged();
@@ -98,13 +103,13 @@ void SystemImage::onUpdateDownloaded()
98103
99104void SystemImage::onUpdateFailed(int /*consecutive_failure_count*/, const QString &last_reason)
100105{
101− qWarning() << Q_FUNC_INFO << "System Update failed:" << last_reason;
106+ WARNING_MSG << "System Update failed: " << last_reason;
102107 setUpdateApplying(false);
103108}
104109
105110void SystemImage::onUpdateApplied(bool applied)
106111{
107− qDebug() << Q_FUNC_INFO << "System Update applied with status:" << applied;
112+ DEBUG_MSG << "System Update applied with status: " << applied;
108113 setUpdateApplying(false);
109114 if (applied) {
110115 resetUpdateStatus();
@@ -115,7 +120,7 @@ void SystemImage::onUpdateApplied(bool applied)
115120void SystemImage::onRebooting(bool status)
116121{
117122 setUpdateApplying(false);
118− qDebug() << "!!! Rebooting:" << status;
123+ DEBUG_MSG << "Rebooting: " << status;
119124}
120125
121126void SystemImage::setUpdateApplying(bool status)