From 1d5a0328033c340b1b82ad2107cb22f4bf0108bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 20 Jan 2015 09:42:26 +0100 Subject: [PATCH] Introduce categorized logging New logging categories KWAYLAND_SERVER and KWAYLAND_CLIENT. --- src/wayland/CMakeLists.txt | 1 + src/wayland/display.cpp | 5 +++-- src/wayland/server/logging.cpp | 21 +++++++++++++++++++++ src/wayland/server/logging_p.h | 25 +++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 src/wayland/server/logging.cpp create mode 100644 src/wayland/server/logging_p.h diff --git a/src/wayland/CMakeLists.txt b/src/wayland/CMakeLists.txt index 8363c3751d..989c64f656 100644 --- a/src/wayland/CMakeLists.txt +++ b/src/wayland/CMakeLists.txt @@ -9,6 +9,7 @@ set(SERVER_LIB_SRCS display.cpp global.cpp keyboard_interface.cpp + logging.cpp output_interface.cpp pointer_interface.cpp region_interface.cpp diff --git a/src/wayland/display.cpp b/src/wayland/display.cpp index a17377aeb0..1675a41472 100644 --- a/src/wayland/display.cpp +++ b/src/wayland/display.cpp @@ -20,6 +20,7 @@ License along with this library. If not, see . #include "display.h" #include "compositor_interface.h" #include "datadevicemanager_interface.h" +#include "logging_p.h" #include "output_interface.h" #include "seat_interface.h" #include "shell_interface.h" @@ -68,7 +69,7 @@ void Display::Private::installSocketNotifier() } int fd = wl_event_loop_get_fd(loop); if (fd == -1) { - qWarning() << "Did not get the file descriptor for the event loop"; + qCWarning(KWAYLAND_SERVER) << "Did not get the file descriptor for the event loop"; return; } QSocketNotifier *m_notifier = new QSocketNotifier(fd, QSocketNotifier::Read, q); @@ -94,7 +95,7 @@ void Display::Private::flush() return; } if (wl_event_loop_dispatch(loop, 0) != 0) { - qWarning() << "Error on dispatching Wayland event loop"; + qCWarning(KWAYLAND_SERVER) << "Error on dispatching Wayland event loop"; } wl_display_flush_clients(display); } diff --git a/src/wayland/server/logging.cpp b/src/wayland/server/logging.cpp new file mode 100644 index 0000000000..bbe44a1ebd --- /dev/null +++ b/src/wayland/server/logging.cpp @@ -0,0 +1,21 @@ +/******************************************************************** +Copyright 2015 Martin Gräßlin + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 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 6 of version 3 of the license. + +This library 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 +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library. If not, see . +*********************************************************************/ +#include "logging_p.h" +Q_LOGGING_CATEGORY(KWAYLAND_SERVER, "kwayland-server"); diff --git a/src/wayland/server/logging_p.h b/src/wayland/server/logging_p.h new file mode 100644 index 0000000000..dc6b19c81e --- /dev/null +++ b/src/wayland/server/logging_p.h @@ -0,0 +1,25 @@ +/******************************************************************** +Copyright 2015 Martin Gräßlin + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 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 6 of version 3 of the license. + +This library 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 +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library. If not, see . +*********************************************************************/ +#ifndef KWAYALND_SERVER_LOGGING_P_H +#define KWAYALND_SERVER_LOGGING_P_H +#include +Q_DECLARE_LOGGING_CATEGORY(KWAYLAND_SERVER) + +#endif