diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-07-25 16:47:32 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-08-02 07:52:43 +0000 |
commit | 03834dd9b04182a07729da5aab307ba90eb80a31 (patch) | |
tree | f1087cbc9927a2b0de4088e243cbe1ad50710624 /src/lib/corelib/logging | |
parent | 0509689635b0de988eec30b6f4fff23b56e381e4 (diff) |
Use categorized logging for the build graph
Use Qt's categorized logging feature for debug and trace messages in
the build graph part of the library.
This greatly simplifies the code as we do not have to check explicitly
for the log level, and we do not have to forward a Logger object.
Change-Id: If44b9ef74ebb2c4670c25e513ec58e1419588196
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/lib/corelib/logging')
-rw-r--r-- | src/lib/corelib/logging/categories.cpp | 48 | ||||
-rw-r--r-- | src/lib/corelib/logging/categories.h | 53 | ||||
-rw-r--r-- | src/lib/corelib/logging/logger.h | 1 | ||||
-rw-r--r-- | src/lib/corelib/logging/logging.pri | 2 |
4 files changed, 104 insertions, 0 deletions
diff --git a/src/lib/corelib/logging/categories.cpp b/src/lib/corelib/logging/categories.cpp new file mode 100644 index 000000000..87d522342 --- /dev/null +++ b/src/lib/corelib/logging/categories.cpp @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qbs. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "categories.h" + +namespace qbs { +namespace Internal { + +Q_LOGGING_CATEGORY(lcBuildGraph, "qbs.buildgraph", QtCriticalMsg) + +} // namespace Internal +} // namespace qbs diff --git a/src/lib/corelib/logging/categories.h b/src/lib/corelib/logging/categories.h new file mode 100644 index 000000000..6d60f0333 --- /dev/null +++ b/src/lib/corelib/logging/categories.h @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qbs. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CATEGORIES_H +#define CATEGORIES_H + +#include <QtCore/qloggingcategory.h> + +namespace qbs { +namespace Internal { + +Q_DECLARE_LOGGING_CATEGORY(lcBuildGraph) + +} // namespace Internal +} // namespace qbs + +#endif // CATEGORIES_H diff --git a/src/lib/corelib/logging/logger.h b/src/lib/corelib/logging/logger.h index aee59dde4..b0b5dd6f3 100644 --- a/src/lib/corelib/logging/logger.h +++ b/src/lib/corelib/logging/logger.h @@ -45,6 +45,7 @@ #include <tools/error.h> #include <QtCore/qbytearray.h> +#include <QtCore/qloggingcategory.h> #include <QtCore/qstring.h> #include <QtCore/qstringlist.h> diff --git a/src/lib/corelib/logging/logging.pri b/src/lib/corelib/logging/logging.pri index 029a4fb30..3a4379a9a 100644 --- a/src/lib/corelib/logging/logging.pri +++ b/src/lib/corelib/logging/logging.pri @@ -1,11 +1,13 @@ include(../../../install_prefix.pri) HEADERS += \ + $$PWD/categories.h \ $$PWD/logger.h \ $$PWD/translator.h \ $$PWD/ilogsink.h SOURCES += \ + $$PWD/categories.cpp \ $$PWD/logger.cpp \ $$PWD/ilogsink.cpp |