mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 10:45:37 +08:00
ref T104, unify logging of inconsistent data
This commit is contained in:
committed by
Mathew Sutcliffe
parent
f53a64396a
commit
c55ad7e142
@@ -12,6 +12,7 @@
|
|||||||
#include "blackmisc/network/networkutils.h"
|
#include "blackmisc/network/networkutils.h"
|
||||||
#include "blackmisc/threadutils.h"
|
#include "blackmisc/threadutils.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
|
#include "blackmisc/verify.h"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QMetaObject>
|
#include <QMetaObject>
|
||||||
@@ -149,4 +150,18 @@ namespace BlackCore
|
|||||||
if (!isEnabled()) { return false; }
|
if (!isEnabled()) { return false; }
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CThreadedReader::logInconsistentData(const CStatusMessage &msg, const char *funcInfo)
|
||||||
|
{
|
||||||
|
if (msg.isEmpty()) { return; }
|
||||||
|
CStatusMessage logMsg(msg);
|
||||||
|
logMsg.addCategory(CLogCategory::dataInconsistency());
|
||||||
|
logMsg.setSeverity(CStatusMessage::SeverityWarning);
|
||||||
|
if (funcInfo)
|
||||||
|
{
|
||||||
|
const QByteArray m(logMsg.getMessage().toLatin1());
|
||||||
|
BLACK_AUDIT_X(false, funcInfo, m.constData());
|
||||||
|
}
|
||||||
|
CLogMessage::preformatted(logMsg);
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -100,6 +100,10 @@ namespace BlackCore
|
|||||||
//! Still enabled etc.
|
//! Still enabled etc.
|
||||||
bool doWorkCheck() const;
|
bool doWorkCheck() const;
|
||||||
|
|
||||||
|
//! Use this to log inconsistent data
|
||||||
|
//! \remark here in a single place severity / format can be adjusted
|
||||||
|
static void logInconsistentData(const BlackMisc::CStatusMessage &msg, const char *funcInfo = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! Trigger doWorkImpl
|
//! Trigger doWorkImpl
|
||||||
void doWork();
|
void doWork();
|
||||||
|
|||||||
Reference in New Issue
Block a user