mirror of https://github.com/Icinga/icinga2.git
Merge pull request #6285 from Icinga/feature/config-validation-timestamps
Add support for config validation log timestamps
This commit is contained in:
commit
88dc230294
|
@ -476,7 +476,7 @@ static int Main()
|
||||||
&GlobalArgumentCompletion, true, autoindex);
|
&GlobalArgumentCompletion, true, autoindex);
|
||||||
rc = 0;
|
rc = 0;
|
||||||
} else if (command) {
|
} else if (command) {
|
||||||
Logger::DisableTimestamp(true);
|
Logger::DisableTimestamp();
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
if (command->GetImpersonationLevel() == ImpersonateRoot) {
|
if (command->GetImpersonationLevel() == ImpersonateRoot) {
|
||||||
if (getuid() != 0) {
|
if (getuid() != 0) {
|
||||||
|
|
|
@ -173,9 +173,14 @@ LogSeverity Logger::GetConsoleLogSeverity()
|
||||||
return m_ConsoleLogSeverity;
|
return m_ConsoleLogSeverity;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logger::DisableTimestamp(bool disable)
|
void Logger::DisableTimestamp()
|
||||||
{
|
{
|
||||||
m_TimestampEnabled = !disable;
|
m_TimestampEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Logger::EnableTimestamp()
|
||||||
|
{
|
||||||
|
m_TimestampEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Logger::IsTimestampEnabled()
|
bool Logger::IsTimestampEnabled()
|
||||||
|
|
|
@ -84,7 +84,8 @@ public:
|
||||||
static void DisableConsoleLog();
|
static void DisableConsoleLog();
|
||||||
static void EnableConsoleLog();
|
static void EnableConsoleLog();
|
||||||
static bool IsConsoleLogEnabled();
|
static bool IsConsoleLogEnabled();
|
||||||
static void DisableTimestamp(bool);
|
static void DisableTimestamp();
|
||||||
|
static void EnableTimestamp();
|
||||||
static bool IsTimestampEnabled();
|
static bool IsTimestampEnabled();
|
||||||
|
|
||||||
static void SetConsoleLogSeverity(LogSeverity logSeverity);
|
static void SetConsoleLogSeverity(LogSeverity logSeverity);
|
||||||
|
|
|
@ -183,8 +183,7 @@ std::vector<String> DaemonCommand::GetArgumentSuggestions(const String& argument
|
||||||
*/
|
*/
|
||||||
int DaemonCommand::Run(const po::variables_map& vm, const std::vector<std::string>& ap) const
|
int DaemonCommand::Run(const po::variables_map& vm, const std::vector<std::string>& ap) const
|
||||||
{
|
{
|
||||||
if (!vm.count("validate"))
|
Logger::EnableTimestamp();
|
||||||
Logger::DisableTimestamp(false);
|
|
||||||
|
|
||||||
Log(LogInformation, "cli")
|
Log(LogInformation, "cli")
|
||||||
<< "Icinga application loader (version: " << Application::GetAppVersion()
|
<< "Icinga application loader (version: " << Application::GetAppVersion()
|
||||||
|
|
Loading…
Reference in New Issue