mirror of https://github.com/Icinga/icinga2.git
parent
07aaeb2bec
commit
597d300e20
|
@ -156,7 +156,6 @@ String Logger::SeverityToString(LogSeverity severity)
|
||||||
case LogCritical:
|
case LogCritical:
|
||||||
return "critical";
|
return "critical";
|
||||||
default:
|
default:
|
||||||
Log(LogCritical, "Logger", "Invalid severity.");
|
|
||||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid severity."));
|
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid severity."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,11 +177,8 @@ LogSeverity Logger::StringToSeverity(const String& severity)
|
||||||
return LogWarning;
|
return LogWarning;
|
||||||
else if (severity == "critical")
|
else if (severity == "critical")
|
||||||
return LogCritical;
|
return LogCritical;
|
||||||
else {
|
else
|
||||||
Log(LogCritical, "Logger")
|
|
||||||
<< "Invalid severity: '" << severity << "'.";
|
|
||||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid severity: " + severity));
|
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid severity: " + severity));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logger::DisableConsoleLog(void)
|
void Logger::DisableConsoleLog(void)
|
||||||
|
@ -219,3 +215,14 @@ bool Logger::IsTimestampEnabled(void)
|
||||||
{
|
{
|
||||||
return m_TimestampEnabled;
|
return m_TimestampEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Logger::ValidateSeverity(const String& value, const ValidationUtils& utils)
|
||||||
|
{
|
||||||
|
ObjectImpl<Logger>::ValidateSeverity(value, utils);
|
||||||
|
|
||||||
|
try {
|
||||||
|
StringToSeverity(value);
|
||||||
|
} catch (...) {
|
||||||
|
BOOST_THROW_EXCEPTION(ValidationError(this, boost::assign::list_of("severity"), "Invalid severity specified: " + value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -92,6 +92,8 @@ public:
|
||||||
|
|
||||||
static void StaticInitialize(void);
|
static void StaticInitialize(void);
|
||||||
|
|
||||||
|
virtual void ValidateSeverity(const String& value, const ValidationUtils& utils) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void Start(bool runtimeCreated) override;
|
virtual void Start(bool runtimeCreated) override;
|
||||||
virtual void Stop(bool runtimeRemoved) override;
|
virtual void Stop(bool runtimeRemoved) override;
|
||||||
|
|
Loading…
Reference in New Issue