mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-03 20:04:29 +02:00
parent
ff80ed1c38
commit
7462c8320a
@ -233,7 +233,7 @@ string(value) | Converts the value to a string.
|
|||||||
number(value) | Converts the value to a number.
|
number(value) | Converts the value to a number.
|
||||||
bool(value) | Converts the value to a bool.
|
bool(value) | Converts the value to a bool.
|
||||||
log(value) | Writes a message to the log. Non-string values are converted to a JSON string.
|
log(value) | Writes a message to the log. Non-string values are converted to a JSON string.
|
||||||
log(severity, facility, value) | Writes a message to the log. `severity` can be one of `LogDebug`, `LogInformation`, `LogWarning` and `LogCritical`. Non-string values are converted to a JSON string.
|
log(severity, facility, value) | Writes a message to the log. `severity` can be one of `LogDebug`, `LogNotice`, `LogInformation`, `LogWarning` and `LogCritical`. Non-string values are converted to a JSON string.
|
||||||
exit(integer) | Terminates the application.
|
exit(integer) | Terminates the application.
|
||||||
|
|
||||||
### <a id="operators"></a> Dictionary Operators
|
### <a id="operators"></a> Dictionary Operators
|
||||||
@ -1494,7 +1494,7 @@ Attributes:
|
|||||||
Name |Description
|
Name |Description
|
||||||
----------------|----------------
|
----------------|----------------
|
||||||
path |**Required.** The log path.
|
path |**Required.** The log path.
|
||||||
severity |**Optional.** The minimum severity for this log. Can be "debug", "information", "warning" or "critical". Defaults to "information".
|
severity |**Optional.** The minimum severity for this log. Can be "debug", "notice", "information", "warning" or "critical". Defaults to "information".
|
||||||
|
|
||||||
|
|
||||||
### <a id="objecttype-sysloglogger"></a> SyslogLogger
|
### <a id="objecttype-sysloglogger"></a> SyslogLogger
|
||||||
@ -1511,7 +1511,7 @@ Attributes:
|
|||||||
|
|
||||||
Name |Description
|
Name |Description
|
||||||
----------------|----------------
|
----------------|----------------
|
||||||
severity |**Optional.** The minimum severity for this log. Can be "debug", "information", "warning" or "critical". Defaults to "warning".
|
severity |**Optional.** The minimum severity for this log. Can be "debug", "notice", "information", "notice", "warning" or "critical". Defaults to "warning".
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ bool Logger::m_ConsoleLogEnabled = true;
|
|||||||
void Logger::StaticInitialize(void)
|
void Logger::StaticInitialize(void)
|
||||||
{
|
{
|
||||||
ScriptVariable::Set("LogDebug", LogDebug, true, true);
|
ScriptVariable::Set("LogDebug", LogDebug, true, true);
|
||||||
|
ScriptVariable::Set("LogNotice", LogNotice, true, true);
|
||||||
ScriptVariable::Set("LogInformation", LogInformation, true, true);
|
ScriptVariable::Set("LogInformation", LogInformation, true, true);
|
||||||
ScriptVariable::Set("LogWarning", LogWarning, true, true);
|
ScriptVariable::Set("LogWarning", LogWarning, true, true);
|
||||||
ScriptVariable::Set("LogCritical", LogCritical, true, true);
|
ScriptVariable::Set("LogCritical", LogCritical, true, true);
|
||||||
@ -142,6 +143,8 @@ String Logger::SeverityToString(LogSeverity severity)
|
|||||||
switch (severity) {
|
switch (severity) {
|
||||||
case LogDebug:
|
case LogDebug:
|
||||||
return "debug";
|
return "debug";
|
||||||
|
case LogNotice:
|
||||||
|
return "notice";
|
||||||
case LogInformation:
|
case LogInformation:
|
||||||
return "information";
|
return "information";
|
||||||
case LogWarning:
|
case LogWarning:
|
||||||
@ -162,6 +165,8 @@ LogSeverity Logger::StringToSeverity(const String& severity)
|
|||||||
{
|
{
|
||||||
if (severity == "debug")
|
if (severity == "debug")
|
||||||
return LogDebug;
|
return LogDebug;
|
||||||
|
else if (severity == "notice")
|
||||||
|
return LogNotice;
|
||||||
else if (severity == "information")
|
else if (severity == "information")
|
||||||
return LogInformation;
|
return LogInformation;
|
||||||
else if (severity == "warning")
|
else if (severity == "warning")
|
||||||
|
@ -34,6 +34,7 @@ namespace icinga
|
|||||||
enum LogSeverity
|
enum LogSeverity
|
||||||
{
|
{
|
||||||
LogDebug,
|
LogDebug,
|
||||||
|
LogNotice,
|
||||||
LogInformation,
|
LogInformation,
|
||||||
LogWarning,
|
LogWarning,
|
||||||
LogCritical
|
LogCritical
|
||||||
|
@ -97,6 +97,12 @@ void StreamLogger::ProcessLogEntry(std::ostream& stream, bool tty, const LogEntr
|
|||||||
|
|
||||||
if (tty) {
|
if (tty) {
|
||||||
switch (entry.Severity) {
|
switch (entry.Severity) {
|
||||||
|
case LogNotice:
|
||||||
|
stream << "\x1b[1;34m"; // blue
|
||||||
|
break;
|
||||||
|
case LogInformation:
|
||||||
|
stream << "\x1b[1;32m"; // green
|
||||||
|
break;
|
||||||
case LogWarning:
|
case LogWarning:
|
||||||
stream << "\x1b[1;33m"; // yellow;
|
stream << "\x1b[1;33m"; // yellow;
|
||||||
break;
|
break;
|
||||||
|
@ -53,6 +53,9 @@ void SyslogLogger::ProcessLogEntry(const LogEntry& entry)
|
|||||||
case LogDebug:
|
case LogDebug:
|
||||||
severity = LOG_DEBUG;
|
severity = LOG_DEBUG;
|
||||||
break;
|
break;
|
||||||
|
case LogNotice:
|
||||||
|
severity = LOG_NOTICE;
|
||||||
|
break;
|
||||||
case LogWarning:
|
case LogWarning:
|
||||||
severity = LOG_WARNING;
|
severity = LOG_WARNING;
|
||||||
break;
|
break;
|
||||||
|
@ -191,7 +191,7 @@ void ApiClient::KeepAliveTimerHandler(void)
|
|||||||
|
|
||||||
BOOST_FOREACH(const ApiClient::Ptr& client, endpoint->GetClients()) {
|
BOOST_FOREACH(const ApiClient::Ptr& client, endpoint->GetClients()) {
|
||||||
if (client->m_Seen < timeout) {
|
if (client->m_Seen < timeout) {
|
||||||
Log(LogInformation, "remote", "Closing connection with inactive endpoint '" + endpoint->GetName() + "'");
|
Log(LogNotice, "remote", "Closing connection with inactive endpoint '" + endpoint->GetName() + "'");
|
||||||
client->Disconnect();
|
client->Disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ void ApiClient::KeepAliveTimerHandler(void)
|
|||||||
|
|
||||||
BOOST_FOREACH(const ApiClient::Ptr& client, listener->GetAnonymousClients()) {
|
BOOST_FOREACH(const ApiClient::Ptr& client, listener->GetAnonymousClients()) {
|
||||||
if (client->m_Seen < timeout) {
|
if (client->m_Seen < timeout) {
|
||||||
Log(LogInformation, "remote", "Closing connection with inactive anonymous endpoint '" + client->GetIdentity() + "'");
|
Log(LogNotice, "remote", "Closing connection with inactive anonymous endpoint '" + client->GetIdentity() + "'");
|
||||||
client->Disconnect();
|
client->Disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user