deskflow/src/lib/gui/Logger.h
sithlord48 1085df54ed refactor: Reuse compliance
build files and documentation: MIT
  images / sources: GPL-2.0-only
  breeze icons: LGPL-2.0-only
  Microsoft MSM file, vc redist license
2025-01-27 17:05:47 -05:00

47 lines
863 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;
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