Fix key when inserting new logger in LoggerMap,

Prepare logBuffer-JSON snapshot view in LoggerManager,
Increase buffered loglines to 500
This commit is contained in:
LordGrey
2023-12-28 17:00:24 +01:00
parent 1166c76582
commit 1cc87831cb
3 changed files with 44 additions and 34 deletions

View File

@@ -6,6 +6,7 @@
#include <QMap>
#include <QAtomicInteger>
#include <QList>
#include <QJsonArray>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
#include <QRecursiveMutex>
@@ -14,8 +15,6 @@
#endif
// stl includes
#include <stdio.h>
#include <stdarg.h>
#ifdef _WIN32
#include <stdexcept>
#endif
@@ -59,7 +58,7 @@ public:
QString function;
unsigned int line;
QString fileName;
uint64_t utime;
qint64 utime;
QString message;
LogLevel level;
QString levelString;
@@ -74,7 +73,7 @@ public:
void setMinLevel(LogLevel level) { _minLevel = static_cast<int>(level); }
LogLevel getMinLevel() const { return static_cast<LogLevel>(int(_minLevel)); }
QString getName() const { return _name; }
QString getSubName() const { return _subname; }
QString getSubName() const { return _subName; }
signals:
void newLogMessage(Logger::T_LOG_MESSAGE);
@@ -95,7 +94,7 @@ private:
static QAtomicInteger<int> GLOBAL_MIN_LOG_LEVEL;
const QString _name;
const QString _subname;
const QString _subName;
const bool _syslogEnabled;
const unsigned _loggerId;
@@ -109,15 +108,15 @@ class LoggerManager : public QObject
public:
static LoggerManager* getInstance();
const QList<Logger::T_LOG_MESSAGE>* getLogMessageBuffer() const { return &_logMessageBuffer; }
public slots:
void handleNewLogMessage(const Logger::T_LOG_MESSAGE&);
QJsonArray getLogMessageBuffer(Logger::LogLevel filter=Logger::UNSET) const;
signals:
void newLogMessage(const Logger::T_LOG_MESSAGE&);
protected:
private:
LoggerManager();
QList<Logger::T_LOG_MESSAGE> _logMessageBuffer;