refs #336 Convenience methods to create validation messages.

This commit is contained in:
Mathew Sutcliffe
2014-10-15 01:53:54 +01:00
parent 5991981789
commit d0894d2cf9
6 changed files with 48 additions and 18 deletions

View File

@@ -40,6 +40,27 @@ namespace BlackMisc
return *this;
}
CLogMessage &CLogMessage::validationInfo(QString format)
{
m_categories.remove(CLogCategory::uncategorized());
m_categories.push_back(CLogCategory::validation());
return info(format);
}
CLogMessage &CLogMessage::validationWarning(QString format)
{
m_categories.remove(CLogCategory::uncategorized());
m_categories.push_back(CLogCategory::validation());
return warning(format);
}
CLogMessage &CLogMessage::validationError(QString format)
{
m_categories.remove(CLogCategory::uncategorized());
m_categories.push_back(CLogCategory::validation());
return error(format);
}
CLogMessage::operator CStatusMessage()
{
m_redundant = true;

View File

@@ -110,6 +110,15 @@ namespace BlackMisc
//! Set the severity to error, providing a format string.
CLogMessage &error(QString format);
//! Set the severity to info, providing a format string, and adding the validation category.
CLogMessage &validationInfo(QString format);
//! Set the severity to warning, providing a format string, and adding the validation category.
CLogMessage &validationWarning(QString format);
//! Set the severity to error, providing a format string, and adding the validation category.
CLogMessage &validationError(QString format);
//! Streaming operators.
//! \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.