XPlor/libs/core/logmanager.h

42 lines
844 B
C
Raw Normal View History

2025-03-01 20:38:52 -05:00
#ifndef LOGMANAGER_H
#define LOGMANAGER_H
#include <QObject>
#include <QString>
#include <functional>
2025-03-01 20:38:52 -05:00
class LogManager : public QObject
{
Q_OBJECT
public:
static LogManager &instance() {
static LogManager instance;
return instance;
}
// Standard logging
2025-03-01 20:38:52 -05:00
void addEntry(const QString &entry);
void addError(const QString &error);
void addLine();
// Debug logging - only logs if debug mode enabled
void debug(const QString &entry);
// Set debug mode checker (called from Settings initialization)
void setDebugChecker(std::function<bool()> checker);
2025-03-01 20:38:52 -05:00
signals:
void entryAdded(const QString &entry);
private:
LogManager() : m_debugChecker(nullptr) {}
2025-03-01 20:38:52 -05:00
~LogManager() {}
std::function<bool()> m_debugChecker;
2025-03-01 20:38:52 -05:00
Q_DISABLE_COPY(LogManager)
};
#endif // LOGMANAGER_H