mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 10:55:32 +08:00
refs #335, log messages directly from status messages
This commit is contained in:
committed by
Roland Winklmeier
parent
1ea330cc06
commit
ffc9cc1b77
@@ -61,6 +61,30 @@ namespace BlackMisc
|
|||||||
return error(format);
|
return error(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CLogMessage &CLogMessage::validation(const CStatusMessage &statusMessage)
|
||||||
|
{
|
||||||
|
switch (statusMessage.getSeverity())
|
||||||
|
{
|
||||||
|
case CStatusMessage::SeverityDebug:
|
||||||
|
case CStatusMessage::SeverityInfo:
|
||||||
|
return validationInfo(statusMessage.getMessage());
|
||||||
|
case CStatusMessage::SeverityWarning:
|
||||||
|
return validation(statusMessage.getMessage());
|
||||||
|
case CStatusMessage::SeverityError:
|
||||||
|
return error(statusMessage.getMessage());
|
||||||
|
default:
|
||||||
|
return validationInfo(statusMessage.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLogMessage::validations(const CStatusMessageList &statusMessages)
|
||||||
|
{
|
||||||
|
foreach(CStatusMessage msg, statusMessages)
|
||||||
|
{
|
||||||
|
validation(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CLogMessage::operator CStatusMessage()
|
CLogMessage::operator CStatusMessage()
|
||||||
{
|
{
|
||||||
m_redundant = true;
|
m_redundant = true;
|
||||||
@@ -164,7 +188,10 @@ namespace BlackMisc
|
|||||||
QString CLogMessageHelper::addDebugFlag(const QString &category) { return addFlag(category, "debug"); }
|
QString CLogMessageHelper::addDebugFlag(const QString &category) { return addFlag(category, "debug"); }
|
||||||
QString CLogMessageHelper::stripFlags(const QString &category) { return category.section("/", 0, 1); }
|
QString CLogMessageHelper::stripFlags(const QString &category) { return category.section("/", 0, 1); }
|
||||||
bool CLogMessageHelper::hasRedundantFlag(const QString &category) { return hasFlag(category, "redundant"); }
|
bool CLogMessageHelper::hasRedundantFlag(const QString &category) { return hasFlag(category, "redundant"); }
|
||||||
bool CLogMessageHelper::hasDebugFlag(const QString &category) { return hasFlag(category, "debug") || category.isEmpty()
|
bool CLogMessageHelper::hasDebugFlag(const QString &category)
|
||||||
|| (QLoggingCategory::defaultCategory() && category == QLoggingCategory::defaultCategory()->categoryName()); }
|
{
|
||||||
|
return hasFlag(category, "debug") || category.isEmpty()
|
||||||
|
|| (QLoggingCategory::defaultCategory() && category == QLoggingCategory::defaultCategory()->categoryName());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
//! \file
|
//! \file
|
||||||
|
|
||||||
|
#include "statusmessagelist.h"
|
||||||
#include "statusmessage.h"
|
#include "statusmessage.h"
|
||||||
#include "logcategorylist.h"
|
#include "logcategorylist.h"
|
||||||
#include "index_sequence.h"
|
#include "index_sequence.h"
|
||||||
@@ -119,6 +120,13 @@ namespace BlackMisc
|
|||||||
//! Set the severity to error, providing a format string, and adding the validation category.
|
//! Set the severity to error, providing a format string, and adding the validation category.
|
||||||
CLogMessage &validationError(QString format);
|
CLogMessage &validationError(QString format);
|
||||||
|
|
||||||
|
//! Set the severity as in \sa CStatusMessage::StatusSeverity , and adding the validation category.
|
||||||
|
CLogMessage &validation(const CStatusMessage &statusMessage);
|
||||||
|
|
||||||
|
//! Set the severity as in \sa CStatusMessage::StatusSeverity , and adding the validation category.
|
||||||
|
//! \todo how to handle return value here, CLogMessageList?
|
||||||
|
void validations(const CStatusMessageList &statusMessages);
|
||||||
|
|
||||||
//! Streaming operators.
|
//! Streaming operators.
|
||||||
//! \details If the format string is empty, the message will consist of all streamed values separated by spaces.
|
//! \details If the format string is empty, the message will consist of all streamed values separated by spaces.
|
||||||
//! Otherwise, the streamed values will replace the place markers %1, %2, %3... in the format string.
|
//! Otherwise, the streamed values will replace the place markers %1, %2, %3... in the format string.
|
||||||
|
|||||||
Reference in New Issue
Block a user