forked from qt-creator/qt-creator
Remove logging wrapper code for Qt 4 compatibility
Change-Id: I95ed943638895b718862f05e3f706dcbef4c6a7d Reviewed-by: Ulf Hermann <ulf.hermann@digia.com>
This commit is contained in:
@@ -36,12 +36,12 @@
|
|||||||
#include <extensionsystem/pluginspec.h>
|
#include <extensionsystem/pluginspec.h>
|
||||||
#include <qtsingleapplication.h>
|
#include <qtsingleapplication.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/logging.h>
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
|
#include <QLoggingCategory>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
|
|||||||
@@ -29,15 +29,12 @@
|
|||||||
|
|
||||||
#include "qmljscodeformatter.h"
|
#include "qmljscodeformatter.h"
|
||||||
|
|
||||||
#include <utils/logging.h>
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
#include <QMetaEnum>
|
#include <QMetaEnum>
|
||||||
#include <QTextDocument>
|
|
||||||
#include <QTextBlock>
|
#include <QTextBlock>
|
||||||
|
#include <QTextDocument>
|
||||||
|
|
||||||
namespace {
|
static Q_LOGGING_CATEGORY(formatterLog, "qtc.qmljs.formatter")
|
||||||
Q_LOGGING_CATEGORY(formatterLog, "qtc.qmljs.formatter")
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace QmlJS {
|
namespace QmlJS {
|
||||||
|
|
||||||
|
|||||||
@@ -29,9 +29,10 @@
|
|||||||
|
|
||||||
#ifndef QMLJSCONSTANTS_H
|
#ifndef QMLJSCONSTANTS_H
|
||||||
#define QMLJSCONSTANTS_H
|
#define QMLJSCONSTANTS_H
|
||||||
|
|
||||||
#include "qmljs_global.h"
|
#include "qmljs_global.h"
|
||||||
|
|
||||||
#include <utils/logging.h>
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
namespace QmlJS {
|
namespace QmlJS {
|
||||||
|
|
||||||
|
|||||||
@@ -29,11 +29,10 @@
|
|||||||
|
|
||||||
#include "qmljsicons.h"
|
#include "qmljsicons.h"
|
||||||
|
|
||||||
#include <utils/logging.h>
|
|
||||||
|
|
||||||
#include <QIcon>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
#include <QIcon>
|
||||||
|
#include <QLoggingCategory>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
|
|
||||||
using namespace QmlJS;
|
using namespace QmlJS;
|
||||||
@@ -43,9 +42,7 @@ enum {
|
|||||||
debug = false
|
debug = false
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace {
|
static Q_LOGGING_CATEGORY(iconsLog, "qtc.qmljs.icons")
|
||||||
Q_LOGGING_CATEGORY(iconsLog, "qtc.qmljs.icons")
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace QmlJS {
|
namespace QmlJS {
|
||||||
|
|
||||||
|
|||||||
@@ -32,15 +32,13 @@
|
|||||||
#include "qmljsqrcparser.h"
|
#include "qmljsqrcparser.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/logging.h>
|
|
||||||
|
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
namespace {
|
static Q_LOGGING_CATEGORY(importsLog, "qtc.qmljs.imports")
|
||||||
Q_LOGGING_CATEGORY(importsLog, "qtc.qmljs.imports")
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace QmlJS {
|
namespace QmlJS {
|
||||||
|
|
||||||
|
|||||||
@@ -33,15 +33,12 @@
|
|||||||
#include "parser/qmljslexer_p.h"
|
#include "parser/qmljslexer_p.h"
|
||||||
#include "parser/qmljsengine_p.h"
|
#include "parser/qmljsengine_p.h"
|
||||||
|
|
||||||
#include <utils/logging.h>
|
|
||||||
|
|
||||||
#include "qmljsutils.h"
|
#include "qmljsutils.h"
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
namespace {
|
static Q_LOGGING_CATEGORY(simpleReaderLog, "qtc.qmljs.simpleReader")
|
||||||
Q_LOGGING_CATEGORY(simpleReaderLog, "qtc.qmljs.simpleReader")
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace QmlJS{
|
namespace QmlJS{
|
||||||
|
|
||||||
|
|||||||
@@ -1,133 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
||||||
** Contact: http://www.qt-project.org/legal
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** 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 Digia. For licensing terms and
|
|
||||||
** conditions see http://qt.digia.com/licensing. For further information
|
|
||||||
** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Digia gives you certain additional
|
|
||||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef LOGGING_H
|
|
||||||
#define LOGGING_H
|
|
||||||
|
|
||||||
#include <qglobal.h>
|
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
//
|
|
||||||
// Qt < 5.2 didn't feature categorized logging:
|
|
||||||
// Just enable qCWarning, qCCritical, but disable qCDebug
|
|
||||||
//
|
|
||||||
class QLoggingCategory
|
|
||||||
{
|
|
||||||
Q_DISABLE_COPY(QLoggingCategory)
|
|
||||||
public:
|
|
||||||
explicit QLoggingCategory(const char *category) : name(category) {}
|
|
||||||
~QLoggingCategory() {}
|
|
||||||
static void setFilterRules(const QString &) {}
|
|
||||||
|
|
||||||
bool isDebugEnabled() const { return false; }
|
|
||||||
bool isWarningEnabled() const { return true; }
|
|
||||||
bool isCriticalEnabled() const { return true; }
|
|
||||||
|
|
||||||
const char *categoryName() const { return name; }
|
|
||||||
|
|
||||||
QLoggingCategory &operator()() { return *this; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
const char *name;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define Q_DECLARE_LOGGING_CATEGORY(name) \
|
|
||||||
extern QLoggingCategory &name();
|
|
||||||
|
|
||||||
// relies on QLoggingCategory(QString) being thread safe!
|
|
||||||
#define Q_LOGGING_CATEGORY(name, string) \
|
|
||||||
QLoggingCategory &name() \
|
|
||||||
{ \
|
|
||||||
static QLoggingCategory category(string); \
|
|
||||||
return category; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
|
|
||||||
|
|
||||||
//
|
|
||||||
// Qt 5.0, 5.1 do have already support for categories in QMessageLogger
|
|
||||||
//
|
|
||||||
|
|
||||||
#define qCDebug(category, ...) \
|
|
||||||
for (bool q_category_enabled = category().isDebugEnabled(); q_category_enabled; q_category_enabled = false) \
|
|
||||||
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).debug(__VA_ARGS__)
|
|
||||||
#define qCWarning(category, ...) \
|
|
||||||
for (bool q_category_enabled = category().isWarningEnabled(); q_category_enabled; q_category_enabled = false) \
|
|
||||||
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).warning(__VA_ARGS__)
|
|
||||||
#define qCCritical(category, ...) \
|
|
||||||
for (bool q_category_enabled = category().isCriticalEnabled(); q_category_enabled; q_category_enabled = false) \
|
|
||||||
QMessageLogger(__FILE__, __LINE__, Q_FUNC_QT_VERSION < 0x053000INFO, category().categoryName()).critical(__VA_ARGS__)
|
|
||||||
|
|
||||||
# else
|
|
||||||
|
|
||||||
//
|
|
||||||
// Qt 4: just map to qDebug etc
|
|
||||||
//
|
|
||||||
|
|
||||||
#define qCDebug(category, ...) \
|
|
||||||
for (bool q_category_enabled = category().isDebugEnabled(); q_category_enabled; q_category_enabled = false) \
|
|
||||||
qDebug(__VA_ARGS__)
|
|
||||||
#define qCWarning(category, ...) \
|
|
||||||
for (bool q_category_enabled = category().isWarningEnabled(); q_category_enabled; q_category_enabled = false) \
|
|
||||||
qWarning(__VA_ARGS__)
|
|
||||||
#define qCCritical(category, ...) \
|
|
||||||
for (bool q_category_enabled = category().isCriticalEnabled(); q_category_enabled; q_category_enabled = false) \
|
|
||||||
qCritical(__VA_ARGS__)
|
|
||||||
|
|
||||||
|
|
||||||
# endif // QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
|
|
||||||
|
|
||||||
#else // QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
|
|
||||||
|
|
||||||
#include <QLoggingCategory>
|
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
|
|
||||||
|
|
||||||
// printf style for qCDebug was only added in Qt 5.3
|
|
||||||
|
|
||||||
#undef qCDebug
|
|
||||||
#undef qCWarning
|
|
||||||
#undef qCCritical
|
|
||||||
|
|
||||||
#define qCDebug(category, ...) \
|
|
||||||
for (bool q_category_enabled = category().isDebugEnabled(); q_category_enabled; q_category_enabled = false) \
|
|
||||||
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).debug(__VA_ARGS__)
|
|
||||||
#define qCWarning(category, ...) \
|
|
||||||
for (bool q_category_enabled = category().isWarningEnabled(); q_category_enabled; q_category_enabled = false) \
|
|
||||||
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).warning(__VA_ARGS__)
|
|
||||||
#define qCCritical(category, ...) \
|
|
||||||
for (bool q_category_enabled = category().isCriticalEnabled(); q_category_enabled; q_category_enabled = false) \
|
|
||||||
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).critical(__VA_ARGS__)
|
|
||||||
|
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
|
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
|
||||||
#endif // LOGGING_H
|
|
||||||
@@ -180,7 +180,6 @@ HEADERS += \
|
|||||||
$$PWD/ansiescapecodehandler.h \
|
$$PWD/ansiescapecodehandler.h \
|
||||||
$$PWD/execmenu.h \
|
$$PWD/execmenu.h \
|
||||||
$$PWD/completinglineedit.h \
|
$$PWD/completinglineedit.h \
|
||||||
$$PWD/logging.h \
|
|
||||||
$$PWD/winutils.h \
|
$$PWD/winutils.h \
|
||||||
$$PWD/itemviews.h \
|
$$PWD/itemviews.h \
|
||||||
$$PWD/treeviewcombobox.h \
|
$$PWD/treeviewcombobox.h \
|
||||||
|
|||||||
@@ -107,7 +107,6 @@ QtcLibrary {
|
|||||||
"linecolumnlabel.cpp",
|
"linecolumnlabel.cpp",
|
||||||
"linecolumnlabel.h",
|
"linecolumnlabel.h",
|
||||||
"listutils.h",
|
"listutils.h",
|
||||||
"logging.h",
|
|
||||||
"multitask.h",
|
"multitask.h",
|
||||||
"navigationtreeview.cpp",
|
"navigationtreeview.cpp",
|
||||||
"navigationtreeview.h",
|
"navigationtreeview.h",
|
||||||
|
|||||||
@@ -36,11 +36,12 @@
|
|||||||
#include <debugger/watchhandler.h>
|
#include <debugger/watchhandler.h>
|
||||||
|
|
||||||
#include <qmldebug/qmldebugconstants.h>
|
#include <qmldebug/qmldebugconstants.h>
|
||||||
#include <utils/logging.h>
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/savedaction.h>
|
#include <utils/savedaction.h>
|
||||||
|
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
using namespace QmlDebug;
|
using namespace QmlDebug;
|
||||||
using namespace QmlDebug::Constants;
|
using namespace QmlDebug::Constants;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#define IOSCONSTANTS_H
|
#define IOSCONSTANTS_H
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <utils/logging.h>
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
namespace Ios {
|
namespace Ios {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|||||||
@@ -29,16 +29,14 @@
|
|||||||
|
|
||||||
#include "iosprobe.h"
|
#include "iosprobe.h"
|
||||||
|
|
||||||
#include <utils/logging.h>
|
|
||||||
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QProcess>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QFileInfo>
|
||||||
#include <QFileInfoList>
|
#include <QFileInfoList>
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
|
static Q_LOGGING_CATEGORY(probeLog, "qtc.ios.probe")
|
||||||
|
|
||||||
namespace {
|
|
||||||
Q_LOGGING_CATEGORY(probeLog, "qtc.ios.probe")
|
|
||||||
}
|
|
||||||
namespace Ios {
|
namespace Ios {
|
||||||
|
|
||||||
static QString qsystem(const QString &exe, const QStringList &args = QStringList())
|
static QString qsystem(const QString &exe, const QStringList &args = QStringList())
|
||||||
|
|||||||
@@ -34,24 +34,22 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/logging.h>
|
|
||||||
|
|
||||||
#include <QProcess>
|
|
||||||
#include <QXmlStreamReader>
|
|
||||||
#include <QSocketNotifier>
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QList>
|
|
||||||
#include <QScopedArrayPointer>
|
|
||||||
#include <QProcessEnvironment>
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QList>
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QProcessEnvironment>
|
||||||
|
#include <QScopedArrayPointer>
|
||||||
|
#include <QSocketNotifier>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QXmlStreamReader>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
namespace {
|
static Q_LOGGING_CATEGORY(toolHandlerLog, "qtc.ios.toolhandler")
|
||||||
Q_LOGGING_CATEGORY(toolHandlerLog, "qtc.ios.toolhandler")
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Ios {
|
namespace Ios {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user