1
0
Fork 0

Merge branch 'devel' of https://github.com/arangodb/arangodb into engine-api

This commit is contained in:
jsteemann 2017-04-04 15:27:38 +02:00
commit 429869d4f4
6 changed files with 25 additions and 0 deletions

View File

@ -1,6 +1,8 @@
devel
-----
* added log topic attribute to /_admin/log api
* removed internal build option `USE_DEV_TIMERS`
Enabling this option activated some proprietary timers for only selected

View File

@ -192,6 +192,14 @@ void RestAdminLogHandler::reportLogs() {
result.close();
result.add("topic", VPackValue(VPackValueType::Array));
for (size_t i = 0; i < length; ++i) {
auto& buf = clean.at(i + static_cast<size_t>(offset));
result.add(VPackValue(LogTopic::lookup(buf._topicId)));
}
result.close();
// second level
result.add("level", VPackValue(VPackValueType::Array));

View File

@ -47,6 +47,7 @@ static void logEntry(LogMessage* message) {
ptr->_timestamp = timestamp;
TRI_CopyString(ptr->_message, message->_message.c_str() + message->_offset,
sizeof(ptr->_message) - 1);
ptr->_topicId = message->_topicId;
}
std::vector<LogBuffer> LogBuffer::entries(LogLevel level, uint64_t start,

View File

@ -44,6 +44,7 @@ struct LogBuffer {
LogLevel _level;
time_t _timestamp;
char _message[256];
size_t _topicId;
};
}

View File

@ -116,6 +116,18 @@ LogTopic* LogTopic::lookup(std::string const& name) {
return it->second;
}
std::string LogTopic::lookup(size_t topicId) {
MUTEX_LOCKER(guard, _namesLock);
for (auto const& it : _names) {
if (it.second->_id == topicId) {
return it.second->_name;
}
}
return std::string("UNKNOWN");
}
LogTopic::LogTopic(std::string const& name)
: LogTopic(name, LogLevel::DEFAULT) {}

View File

@ -40,6 +40,7 @@ class LogTopic {
static std::vector<std::pair<std::string, LogLevel>> logLevelTopics();
static void setLogLevel(std::string const&, LogLevel);
static LogTopic* lookup(std::string const&);
static std::string lookup(size_t topicId);
public:
explicit LogTopic(std::string const& name);