Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmlloggingcategory_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 Pelagicore AG
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant
4
5#ifndef QQMLLOGGINGCATEGORY_P_H
6#define QQMLLOGGINGCATEGORY_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <private/qqmlloggingcategorybase_p.h>
20
21#include <QtQmlMeta/qtqmlmetaexports.h>
22
23#include <QtQml/qqml.h>
24#include <QtQml/qqmlparserstatus.h>
25
26#include <QtCore/private/qglobal_p.h>
27#include <QtCore/qloggingcategory.h>
28#include <QtCore/qobject.h>
29#include <QtCore/qstring.h>
30
32
33class Q_QMLMETA_EXPORT QQmlLoggingCategory : public QQmlLoggingCategoryBase, public QQmlParserStatus
34{
35 Q_OBJECT
36 Q_INTERFACES(QQmlParserStatus)
37
38 Q_PROPERTY(QString name READ name WRITE setName)
39 Q_PROPERTY(DefaultLogLevel defaultLogLevel READ defaultLogLevel WRITE setDefaultLogLevel REVISION(2, 12))
40 QML_NAMED_ELEMENT(LoggingCategory)
41 QML_ADDED_IN_VERSION(2, 8)
42
43public:
44 enum DefaultLogLevel {
45 Debug = QtDebugMsg,
46 Info = QtInfoMsg,
47 Warning = QtWarningMsg,
48 Critical = QtCriticalMsg,
49 Fatal = QtFatalMsg
50 };
51 Q_ENUM(DefaultLogLevel);
52
53 QQmlLoggingCategory(QObject *parent = nullptr);
54 virtual ~QQmlLoggingCategory();
55
56 DefaultLogLevel defaultLogLevel() const;
57 void setDefaultLogLevel(DefaultLogLevel defaultLogLevel);
58 QString name() const;
59 void setName(const QString &name);
60
61 void classBegin() override;
62 void componentComplete() override;
63
64 void forceCompletion() final;
65
66private:
67 QByteArray m_name;
68 DefaultLogLevel m_defaultLogLevel = Debug;
69 bool m_initialized;
70};
71
72QT_END_NAMESPACE
73
74#endif // QQMLLOGGINGCATEGORY_H