diff --git a/CMakeLists.txt b/CMakeLists.txt index 0435ea6821164e856cd0f98e54093914c22e3a49..45e085fe14342f5092eef484a7dfb2e4494efff6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,7 @@ include(ECMAddTests) include(ECMSetupVersion) include(ECMInstallIcons) include(FeatureSummary) +include(ECMQtDeclareLoggingCategory) include(GenerateExportHeader) include(KDEConnectMacros.cmake) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index a3e0263b2655532f5d5623de4a139b3bbbdc803b..5cc95fa646398b8f99bff012638d6266e56693f2 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -34,10 +34,16 @@ set(kdeconnectcore_SRCS compositefiletransferjob.cpp daemon.cpp device.cpp - core_debug.cpp notificationserverinfo.cpp ) +ecm_qt_declare_logging_category( + kdeconnectcore_SRCS + HEADER core_debug.h + IDENTIFIER KDECONNECT_CORE + CATEGORY_NAME kdeconnect.core +) + add_library(kdeconnectcore ${kdeconnectcore_SRCS}) target_include_directories(kdeconnectcore PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) diff --git a/core/core_debug.cpp b/core/core_debug.cpp deleted file mode 100644 index c82f65d73fb6d6283037985525c1b4ba9413c6f6..0000000000000000000000000000000000000000 --- a/core/core_debug.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright 2013 Albert Vaca - * - * 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 . - */ - -#include "core_debug.h" - -Q_LOGGING_CATEGORY(KDECONNECT_CORE, "kdeconnect.core") - -#if defined(__GNU_LIBRARY__) -#include -#include -#include -#endif - -void logBacktrace() -{ -#if defined(__GNU_LIBRARY__) - void* array[32]; - size_t size = backtrace (array, 32); - char** strings = backtrace_symbols (array, size); - backtrace_symbols_fd(array, size, STDERR_FILENO); - free (strings); -#endif -} diff --git a/core/core_debug.h b/core/core_debug.h deleted file mode 100644 index 3daf0f7256843e53191da3834eb1bb865f2c35fd..0000000000000000000000000000000000000000 --- a/core/core_debug.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright 2013 Albert Vaca - * - * 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 . - */ - -#ifndef CORE_DEBUG_H -#define CORE_DEBUG_H - -#include - -#include "kdeconnectcore_export.h" - -KDECONNECTCORE_EXPORT Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_CORE) - -void logBacktrace(); - -#endif //CORE_DEBUG_H diff --git a/interfaces/CMakeLists.txt b/interfaces/CMakeLists.txt index 23b8a4507826ffee0ff5357a92bf6e215c87aab0..921faadae820d27c1efc5ddbe005b72a89aebc79 100644 --- a/interfaces/CMakeLists.txt +++ b/interfaces/CMakeLists.txt @@ -19,6 +19,13 @@ set(libkdeconnect_SRC # modeltest.cpp ) +ecm_qt_declare_logging_category( + libkdeconnect_SRC + HEADER interfaces_debug.h + IDENTIFIER KDECONNECT_INTERFACES + CATEGORY_NAME kdeconnect.interfaces +) + geninterface(${CMAKE_SOURCE_DIR}/core/daemon.h daemoninterface) geninterface(${CMAKE_SOURCE_DIR}/core/device.h deviceinterface) geninterface(${CMAKE_SOURCE_DIR}/plugins/battery/batterydbusinterface.h devicebatteryinterface) diff --git a/interfaces/devicesmodel.cpp b/interfaces/devicesmodel.cpp index 25f2bc495a069e9d5554ea72838fa738d20652d8..07bc3f5a9c8468a035912ebced069835a71a4859 100644 --- a/interfaces/devicesmodel.cpp +++ b/interfaces/devicesmodel.cpp @@ -33,8 +33,6 @@ #include // #include "modeltest.h" -Q_LOGGING_CATEGORY(KDECONNECT_INTERFACES, "kdeconnect.interfaces"); - static QString createId() { return QCoreApplication::instance()->applicationName()+QString::number(QCoreApplication::applicationPid()); } Q_GLOBAL_STATIC_WITH_ARGS(QString, s_keyId, (createId())); diff --git a/interfaces/interfaces_debug.h b/interfaces/interfaces_debug.h deleted file mode 100644 index 2cdb99e697705e45cc7d471aae68a8b561982807..0000000000000000000000000000000000000000 --- a/interfaces/interfaces_debug.h +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2014 Alejandro Fiestas Olivares - * - * 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 . - */ - -#ifndef KDECONNECT_INTERFACE_DEBUG_H -#define KDECONNECT_INTERFACE_DEBUG_H - -#include - -Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_INTERFACES) - -#endif //KDECONNECT_INTERFACE_DEBUG_H