Use logging rule for front end
This commit is contained in:
parent
7017818acb
commit
7b6dd14fd1
1 changed files with 5 additions and 5 deletions
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
class DebugLogJS : public QObject
|
class DebugLogJS : public QObject
|
||||||
{
|
{
|
||||||
|
@ -30,11 +31,9 @@ class DebugLogJS : public QObject
|
||||||
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
|
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
#ifdef QT_QML_DEBUG
|
DebugLogJS(QObject* parent = Q_NULLPTR) : QObject(parent), category("fernschreiber.JS") {
|
||||||
DebugLogJS(QObject* parent = Q_NULLPTR) : QObject(parent), enabled(true) {}
|
enabled = category.isDebugEnabled();
|
||||||
#else
|
}
|
||||||
DebugLog(QObject* parent = Q_NULLPTR) : QObject(parent), enabled(false) {}
|
|
||||||
#endif
|
|
||||||
static QObject* createSingleton(QQmlEngine*, QJSEngine*) { return new DebugLogJS(); }
|
static QObject* createSingleton(QQmlEngine*, QJSEngine*) { return new DebugLogJS(); }
|
||||||
bool isEnabled() const { return enabled; }
|
bool isEnabled() const { return enabled; }
|
||||||
void setEnabled(bool value) {
|
void setEnabled(bool value) {
|
||||||
|
@ -47,6 +46,7 @@ Q_SIGNALS:
|
||||||
void enabledChanged(bool value);
|
void enabledChanged(bool value);
|
||||||
private:
|
private:
|
||||||
bool enabled;
|
bool enabled;
|
||||||
|
const QLoggingCategory category;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DEBUGLOG_H
|
#endif // DEBUGLOG_H
|
||||||
|
|
Loading…
Reference in a new issue