Module: check_mk
Branch: master
Commit: d83d340006d50635788c8aca7ff02dc3069d074e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d83d340006d506…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Aug 1 08:49:27 2017 +0200
Simplification: Merge 2 functions.
Change-Id: I35fdd8b1357c5484ad43be588c93004cf354c709
---
livestatus/src/LogEntry.cc | 36 +++++++++++++++---------------------
livestatus/src/LogEntry.h | 4 +---
2 files changed, 16 insertions(+), 24 deletions(-)
diff --git a/livestatus/src/LogEntry.cc b/livestatus/src/LogEntry.cc
index 94cf6f0..f3a2fb2 100644
--- a/livestatus/src/LogEntry.cc
+++ b/livestatus/src/LogEntry.cc
@@ -88,9 +88,7 @@ LogEntry::LogEntry(MonitoringCore *mc, unsigned lineno, const char
*line)
if (classifyLogMessage()) {
updateReferences(mc);
} else {
- handleTextEntry() || handleProgrammEntry(); // Performance killer
- // strstr in
- // handleProgrammEntry!
+ handleEntry();
}
// rest is Class::INFO
}
@@ -339,40 +337,36 @@ void LogEntry::applyWorkarounds() {
: static_cast<int>(parseServiceState(_state_type));
}
-bool LogEntry::handleTextEntry() {
+void LogEntry::handleEntry() {
if (strncmp(_text, "LOG VERSION: 2.0", 16) == 0) {
_logclass = Class::program;
_type = LogEntryType::log_version;
- return true;
+ return;
}
- if ((strncmp(_text, "logging initial states", 22) == 0) ||
- (strncmp(_text, "logging intitial states", 23) == 0)) {
+ if (strncmp(_text, "logging initial states", 22) == 0 ||
+ strncmp(_text, "logging intitial states", 23) == 0) {
_logclass = Class::program;
_type = LogEntryType::log_initial_states;
- return true;
+ return;
}
- return false;
-}
-
-bool LogEntry::handleProgrammEntry() {
- if ((strstr(_text, "starting...") != nullptr) ||
- (strstr(_text, "active mode...") != nullptr)) {
+ if (strstr(_text, "starting...") != nullptr ||
+ strstr(_text, "active mode...") != nullptr) {
_logclass = Class::program;
_type = LogEntryType::core_starting;
- return true;
+ return;
}
- if ((strstr(_text, "shutting down...") != nullptr) ||
- (strstr(_text, "Bailing out") != nullptr) ||
- (strstr(_text, "standby mode...") != nullptr)) {
+ if (strstr(_text, "shutting down...") != nullptr ||
+ strstr(_text, "Bailing out") != nullptr ||
+ strstr(_text, "standby mode...") != nullptr) {
_logclass = Class::program;
_type = LogEntryType::core_stopping;
- return true;
+ return;
}
if (strstr(_text, "restarting...") != nullptr) {
_logclass = Class::program;
- return true;
+ _type = LogEntryType::none;
+ return;
}
- return false;
}
namespace {
diff --git a/livestatus/src/LogEntry.h b/livestatus/src/LogEntry.h
index 0e6f165..ca9fabd 100644
--- a/livestatus/src/LogEntry.h
+++ b/livestatus/src/LogEntry.h
@@ -132,9 +132,7 @@ private:
bool assign(Param par, char **scan);
void applyWorkarounds();
bool classifyLogMessage();
-
- bool handleProgrammEntry();
- bool handleTextEntry();
+ void handleEntry();
};
#endif // LogEntry_h