Commit 1d361642 authored by Antonio Larrosa Jimenez's avatar Antonio Larrosa Jimenez
Browse files

Use ecm_qt_declare_logging_category to declare the logging categories

This automatizes the generation of logging categories so a
kdeconnect-kde.categories is generated and installed to
/usr/share/qlogging-categories5/ so kdebugsettings can use it.

Also, sets the default logging level to Warning. So now the logs
of users won't be filled with debug messages but they can
modify the configuration easily with kdebugsettings.
parent 8bf49850
Pipeline #21386 passed with stage
in 5 minutes and 29 seconds
......@@ -20,6 +20,7 @@ include(KDECMakeSettings)
include(ECMAddTests)
include(ECMSetupVersion)
include(ECMInstallIcons)
include(ECMQtDeclareLoggingCategory)
include(FeatureSummary)
include(GenerateExportHeader)
if (NOT SAILFISHOS)
......@@ -124,4 +125,6 @@ if(BUILD_TESTING)
add_subdirectory(tests)
endif()
ecm_qt_install_logging_categories(EXPORT kdeconnect-kde FILE kdeconnect-kde.categories SORT DESTINATION "${KDE_INSTALL_LOGGINGCATEGORIESDIR}")
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
add_definitions(-DTRANSLATION_DOMAIN=\"kdeconnect-core\")
set(debug_file_SRCS)
ecm_qt_declare_logging_category(
debug_file_SRCS HEADER kdeconnect_debug.h
IDENTIFIER KDECONNECT_CORE CATEGORY_NAME kdeconnect.core
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (core)")
set(KDECONNECT_PRIVATE_DBUS_ADDR unix:tmpdir=/tmp)
if(WIN32)
set(KDECONNECT_PRIVATE_DBUS_ADDR tcp:host=localhost,port=0)
......@@ -39,6 +47,7 @@ set(kdeconnectcore_SRCS
device.cpp
core_debug.cpp
notificationserverinfo.cpp
${debug_file_SRCS}
)
add_library(kdeconnectcore ${kdeconnectcore_SRCS})
......
......@@ -20,8 +20,6 @@
#include "core_debug.h"
Q_LOGGING_CATEGORY(KDECONNECT_CORE, "kdeconnect.core")
#if defined(__GNU_LIBRARY__)
#include <execinfo.h>
#include <stdlib.h>
......
......@@ -21,11 +21,8 @@
#ifndef CORE_DEBUG_H
#define CORE_DEBUG_H
#include <QLoggingCategory>
#include "kdeconnectcore_export.h"
KDECONNECTCORE_EXPORT Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_CORE)
#include "kdeconnect_debug.h"
void logBacktrace();
......
add_definitions(-DTRANSLATION_DOMAIN="kdeconnect-kded")
add_executable(kdeconnectd kdeconnectd.cpp)
set(debug_file_SRCS)
ecm_qt_declare_logging_category(
debug_file_SRCS HEADER kdeconnectd_debug.h
IDENTIFIER KDECONNECT_DAEMON CATEGORY_NAME kdeconnect.daemon
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (daemon)")
add_executable(kdeconnectd kdeconnectd.cpp ${debug_file_SRCS})
target_include_directories(kdeconnectd PUBLIC ${CMAKE_BINARY_DIR})
target_link_libraries(kdeconnectd kdeconnectcore KF5::KIOWidgets KF5::DBusAddons KF5::Notifications KF5::I18n Qt5::Widgets)
......
......@@ -21,7 +21,6 @@
#include <QApplication>
#include <QNetworkAccessManager>
#include <QTimer>
#include <QLoggingCategory>
#include <QCommandLineOption>
#include <QCommandLineParser>
#include <QDBusMessage>
......@@ -42,9 +41,7 @@
#include "core/device.h"
#include "core/backends/pairinghandler.h"
#include "kdeconnect-version.h"
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_DAEMON)
Q_LOGGING_CATEGORY(KDECONNECT_DAEMON, "kdeconnect.daemon")
#include "kdeconnectd_debug.h"
class DesktopDaemon : public Daemon
{
......
add_definitions(-DTRANSLATION_DOMAIN="kdeconnect-fileitemaction")
add_library(kdeconnectfileitemaction MODULE sendfileitemaction.cpp)
set(debug_file_SRCS)
ecm_qt_declare_logging_category(
debug_file_SRCS HEADER kdeconnect_fileitemaction_debug.h
IDENTIFIER KDECONNECT_FILEITEMACTION CATEGORY_NAME kdeconnect.fileitemaction
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (fileitemaction)")
add_library(kdeconnectfileitemaction MODULE sendfileitemaction.cpp ${debug_file_SRCS})
target_link_libraries(
kdeconnectfileitemaction
KF5::KIOWidgets
......
......@@ -37,9 +37,9 @@
#include <dbushelper.h>
K_PLUGIN_CLASS_WITH_JSON(SendFileItemAction, "kdeconnectsendfile.json")
#include "kdeconnect_fileitemaction_debug.h"
Q_LOGGING_CATEGORY(KDECONNECT_FILEITEMACTION, "kdeconnect.fileitemaction")
K_PLUGIN_CLASS_WITH_JSON(SendFileItemAction, "kdeconnectsendfile.json")
SendFileItemAction::SendFileItemAction(QObject* parent, const QVariantList& ): KAbstractFileItemActionPlugin(parent)
{
......
......@@ -23,13 +23,11 @@
#include <KFileItemListProperties>
#include <KAbstractFileItemActionPlugin>
#include <QLoggingCategory>
class QAction;
class KFileItemListProperties;
class QWidget;
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_FILEITEMACTION)
class SendFileItemAction : public KAbstractFileItemActionPlugin
{
Q_OBJECT
......
......@@ -10,6 +10,19 @@ function(geninterface source_h output_h)
set(libkdeconnect_SRC ${libkdeconnect_SRC} PARENT_SCOPE)
endfunction()
set(debug_files_SRCS)
ecm_qt_declare_logging_category(
debug_files_SRCS HEADER interfaces_conversation_message_debug.h
IDENTIFIER CONVERSATION_MESSAGE_LOGGING_CATEGORY CATEGORY_NAME kdeconnect.interfaces.conversationmessage
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (conversation message)")
ecm_qt_declare_logging_category(
debug_files_SRCS HEADER interfaces_debug.h
IDENTIFIER KDECONNECT_INTERFACES CATEGORY_NAME kdeconnect.interfaces
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (interfaces)")
set(libkdeconnect_SRC
dbusinterfaces.cpp
devicesmodel.cpp
......@@ -20,6 +33,7 @@ set(libkdeconnect_SRC
remotesinksmodel.cpp
devicespluginfilterproxymodel.cpp
# modeltest.cpp
${debug_files_SRCS}
)
geninterface(${PROJECT_SOURCE_DIR}/core/daemon.h daemoninterface)
......
......@@ -20,10 +20,9 @@
#include "conversationmessage.h"
#include <QLoggingCategory>
#include <QVariantMap>
Q_LOGGING_CATEGORY(CONVERSATION_MESSAGE_LOGGING_CATEGORY, "kdeconnect.interfaces.conversationmessage")
#include "interfaces_conversation_message_debug.h"
ConversationMessage::ConversationMessage(const QVariantMap& args)
: m_eventField(args[QStringLiteral("event")].toInt()),
......
......@@ -22,12 +22,9 @@
#define PLUGINS_TELEPHONY_CONVERSATIONMESSAGE_H_
#include <QDBusMetaType>
#include <QLoggingCategory>
#include "kdeconnectinterfaces_export.h"
Q_DECLARE_LOGGING_CATEGORY(CONVERSATION_MESSAGE_LOGGING_CATEGORY)
class ConversationAddress;
class KDECONNECTINTERFACES_EXPORT ConversationMessage
......
......@@ -32,7 +32,7 @@
#include <dbushelper.h>
// #include "modeltest.h"
Q_LOGGING_CATEGORY(KDECONNECT_INTERFACES, "kdeconnect.interfaces");
#include "interfaces_debug.h"
static QString createId() { return QCoreApplication::instance()->applicationName()+QString::number(QCoreApplication::applicationPid()); }
......
/**
* Copyright 2014 Alejandro Fiestas Olivares <afiestas@kde.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef KDECONNECT_INTERFACES_DEBUG_H
#define KDECONNECT_INTERFACES_DEBUG_H
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_INTERFACES)
#endif //KDECONNECT_INTERFACES_DEBUG_H
......@@ -19,7 +19,6 @@
*/
#include "notificationsmodel.h"
#include "interfaces_debug.h"
#include <QDebug>
#include <QIcon>
......@@ -30,6 +29,7 @@
//In older Qt released, qAsConst isnt available
#include "core/qtcompat_p.h"
#include "interfaces_debug.h"
NotificationsModel::NotificationsModel(QObject* parent)
: QAbstractListModel(parent)
......
include_directories(${CMAKE_SOURCE_DIR})
add_definitions(-DTRANSLATION_DOMAIN="kdeconnect-kio")
set(debug_file_SRCS)
ecm_qt_declare_logging_category(
debug_file_SRCS HEADER kdeconnectkio_debug.h
IDENTIFIER KDECONNECT_KIO CATEGORY_NAME kdeconnect.kio
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (kio)")
set(kio_kdeconnect_PART_SRCS
kiokdeconnect.cpp
${debug_file_SRCS}
)
add_library(kio_kdeconnect MODULE ${kio_kdeconnect_PART_SRCS})
......
......@@ -29,7 +29,7 @@
#include <QDebug>
#include <QtPlugin>
Q_LOGGING_CATEGORY(KDECONNECT_KIO, "kdeconnect.kio")
#include "kdeconnectkio_debug.h"
class KIOPluginForMetaData : public QObject
{
......
......@@ -22,14 +22,11 @@
#define KIOKDECONNECT_H
#include <QObject>
#include <QLoggingCategory>
#include <kio/slavebase.h>
#include "interfaces/dbusinterfaces.h"
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_KIO)
class KioKdeconnect : public QObject, public KIO::SlaveBase
{
Q_OBJECT
......
set(debug_file_SRCS)
ecm_qt_declare_logging_category(
debug_file_SRCS HEADER plugin_battery_debug.h
IDENTIFIER KDECONNECT_PLUGIN_BATTERY CATEGORY_NAME kdeconnect.plugin.battery
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin battery)")
set(kdeconnect_battery_SRCS
batteryplugin.cpp
batterydbusinterface.cpp
${debug_file_SRCS}
)
kdeconnect_add_plugin(kdeconnect_battery JSON kdeconnect_battery.json SOURCES ${kdeconnect_battery_SRCS})
......
......@@ -23,6 +23,7 @@
#include <QDebug>
#include <core/device.h>
#include "plugin_battery_debug.h"
QMap<QString, BatteryDbusInterface *> BatteryDbusInterface::s_dbusInterfaces;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment