fixes for style and consistency

This commit is contained in:
Guenter Obiltschnig 2015-08-20 14:55:17 +02:00
parent 74ffb112bc
commit fafe691a04
2 changed files with 19 additions and 10 deletions

View File

@ -23,9 +23,9 @@
#include "Poco/Foundation.h"
#include "Poco/Formatter.h"
#include "Poco/Message.h"
#include <vector>
namespace Poco {
@ -105,6 +105,8 @@ public:
/// for details.
/// * times: Specifies whether times are adjusted for local time
/// or taken as they are in UTC. Supported values are "local" and "UTC".
/// * priorityNames: Provide a comma-separated list of custom priority names,
/// e.g. "Fatal, Critical, Error, Warning, Notice, Information, Debug, Trace"
///
/// If any other property name is given, a PropertyNotSupported
/// exception is thrown.
@ -145,8 +147,8 @@ private:
std::vector<PatternAction> _patternActions;
bool _localTime;
std::string _pattern;
std::string _priorityNames;
std::string _priorities[9];
std::string _priorityNames;
std::string _priorities[9];
};

View File

@ -249,15 +249,22 @@ namespace
};
}
void PatternFormatter::parsePriorityNames()
void PatternFormatter::parsePriorityNames()
{
for (int i = 0; i <= 8; i++)
{
for (int i = 0; i <= 8; i++)
_priorities[i] = priorities[i];
StringTokenizer st (_priorityNames, ".", StringTokenizer::TOK_TRIM);
if (st.count() == 8)
for (int i = 1; i <= 8; i++)
_priorities[i] = st[i-1];
_priorities[i] = priorities[i];
}
StringTokenizer st(_priorityNames, ",;", StringTokenizer::TOK_TRIM);
if (st.count() == 8)
{
for (int i = 1; i <= 8; i++)
_priorities[i] = st[i - 1];
}
else throw Poco::SyntaxException("priorityNames property must specify a comma-separated list of 8 property names");
}
const std::string& PatternFormatter::getPriorityName(int prio)
{