Module: check_mk
Branch: master
Commit: b9cde49cdf500aefd8424dc03f9dc48a8344aa46
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b9cde49cdf500a…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Thu Oct 27 14:25:05 2016 +0200
Fetched Livestatus from downstream.
---
livestatus/src/EventConsoleConnection.cc | 4 ++--
livestatus/src/Store.cc | 24 ++++++++++++++++--------
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/livestatus/src/EventConsoleConnection.cc
b/livestatus/src/EventConsoleConnection.cc
index 0d53f61..50e47cd 100644
--- a/livestatus/src/EventConsoleConnection.cc
+++ b/livestatus/src/EventConsoleConnection.cc
@@ -59,7 +59,7 @@ void EventConsoleConnection::run() {
close(_socket);
return;
}
- Informational(&_logger) << "successfully connected";
+ Debug(&_logger) << "successfully connected";
if (!writeRequest()) {
generic_error ge("cannot write");
@@ -69,7 +69,7 @@ void EventConsoleConnection::run() {
Alert(&_logger) << ge;
}
- Informational(&_logger) << "closing connection";
+ Debug(&_logger) << "closing connection";
close(_socket);
}
diff --git a/livestatus/src/Store.cc b/livestatus/src/Store.cc
index c6db114..5aa95c9 100644
--- a/livestatus/src/Store.cc
+++ b/livestatus/src/Store.cc
@@ -41,7 +41,7 @@ extern Encoding g_data_encoding;
extern unsigned long g_max_cached_messages;
using std::chrono::duration_cast;
-using std::chrono::microseconds;
+using std::chrono::milliseconds;
using std::chrono::system_clock;
using std::list;
using std::lock_guard;
@@ -130,10 +130,18 @@ list<string> getLines(InputBuffer *input) {
} // namespace
void Store::logRequest(const string &line, const list<string> &lines) {
- Informational info(_logger);
- info << "Request: " << line;
- for (const auto &l : lines) {
- info << R"(\n)" << l;
+ Informational log(_logger);
+ log << "request: " << line;
+ if (_logger->isLoggable(LogLevel::debug)) {
+ for (const auto &l : lines) {
+ log << R"(\n)" << l;
+ }
+ } else {
+ size_t s = lines.size();
+ if (s > 0) {
+ log << R"(\n{)" << s << (s == 1 ? " line
follows" : " lines follow")
+ << "...}";
+ }
}
}
@@ -235,8 +243,8 @@ void Store::answerGetRequest(const list<string> &lines,
OutputBuffer *output,
auto start = system_clock::now();
Query(lines, table, g_data_encoding).process(output);
- auto elapsed = duration_cast<microseconds>(system_clock::now() - start);
- Informational(_logger) << "Time to process request: " <<
elapsed.count()
- << "us. Size of answer: " <<
output->size()
+ auto elapsed = duration_cast<milliseconds>(system_clock::now() - start);
+ Informational(_logger) << "processed request in " <<
elapsed.count()
+ << " ms, replied with " <<
output->size()
<< " bytes";
}