deskflow/src/lib/gui/Logger.h
sithlord48 d246d9527a Feat: Define QT_NO_KEYWORDS, allowing us to use Qt in more places
must use Q_SIGNALS, Q_SLOTS and Q_EMIT in place of signals, slots and emit macros
2025-06-02 14:28:51 -07:00

48 lines
865 B
C++

/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2024 Symless Ltd.
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
*/
#pragma once
#include <QObject>
#ifdef NDEBUG
const bool kDebug = false;
#else
const bool kDebug = true;
#endif
namespace deskflow::gui {
class Logger : public QObject
{
Q_OBJECT
public:
static Logger &instance()
{
return s_instance;
}
void loadEnvVars();
void handleMessage(const QtMsgType type, const QString &fileLine, const QString &message);
void logVerbose(const QString &message) const;
Q_SIGNALS:
void newLine(const QString &line);
private:
static Logger s_instance;
bool m_debug = kDebug;
bool m_verbose = false;
};
inline void logVerbose(const QString &message)
{
Logger::instance().logVerbose(message);
}
} // namespace deskflow::gui