diff --git a/arangod/Views/LoggerView.cpp b/arangod/Views/LoggerView.cpp index a9451805e0..9ecab042f3 100644 --- a/arangod/Views/LoggerView.cpp +++ b/arangod/Views/LoggerView.cpp @@ -69,11 +69,22 @@ static std::string LevelEnumToString(LogLevel level) { } } +#define VIEW_LOG_TOPIC(a) \ + !arangodb::Logger::isEnabled(static_cast(a), \ + Logger::VIEWS) \ + ? (void)0 \ + : arangodb::LogVoidify() & (arangodb::LoggerStream() \ + << static_cast(a) \ + << Logger::VIEWS \ + << arangodb::Logger::LINE(__LINE__) \ + << arangodb::Logger::FILE(__FILE__) \ + << arangodb::Logger::FUNCTION(__FUNCTION__)) + std::string LoggerView::type("logger"); std::unique_ptr LoggerView::creator( LogicalView* view, arangodb::velocypack::Slice const& info, bool isNew) { - LOG_TOPIC(INFO, Logger::FIXME) + LOG_TOPIC(TRACE, Logger::VIEWS) << "called LoggerView::creator with data: " << info.toJson() << ", isNew: " << isNew; @@ -101,7 +112,7 @@ LoggerView::LoggerView(ConstructionGuard const&, LogicalView* logical, arangodb::Result LoggerView::updateProperties( arangodb::velocypack::Slice const& slice, bool partialUpdate, bool doSync) { - LOG_TOPIC(INFO, Logger::FIXME) + VIEW_LOG_TOPIC(_level) << "called LoggerView::updateProperties with data " << slice.toJson() << ". view data: " << _logicalView->toVelocyPack(true, false).slice().toJson(); @@ -120,7 +131,7 @@ arangodb::Result LoggerView::updateProperties( /// @brief export properties void LoggerView::getPropertiesVPack(velocypack::Builder& builder) const { - LOG_TOPIC(INFO, Logger::FIXME) << "called LoggerView::getPropertiesVPack"; + VIEW_LOG_TOPIC(_level) << "called LoggerView::getPropertiesVPack"; TRI_ASSERT(builder.isOpenObject()); builder.add("level", VPackValue(LevelEnumToString(_level))); @@ -129,13 +140,13 @@ void LoggerView::getPropertiesVPack(velocypack::Builder& builder) const { /// @brief opens an existing view void LoggerView::open() { - LOG_TOPIC(INFO, Logger::FIXME) + VIEW_LOG_TOPIC(_level) << "called LoggerView::open. view data: " << _logicalView->toVelocyPack(true, false).slice().toJson(); } void LoggerView::drop() { - LOG_TOPIC(INFO, Logger::FIXME) + VIEW_LOG_TOPIC(_level) << "called LoggerView::drop. view data: " << _logicalView->toVelocyPack(true, false).slice().toJson(); } diff --git a/lib/Logger/LogTopic.cpp b/lib/Logger/LogTopic.cpp index aaa30cb776..d13ea85299 100644 --- a/lib/Logger/LogTopic.cpp +++ b/lib/Logger/LogTopic.cpp @@ -67,6 +67,7 @@ LogTopic Logger::SYSCALL("syscall", LogLevel::INFO); LogTopic Logger::THREADS("threads", LogLevel::WARN); LogTopic Logger::TRANSACTIONS("trx", LogLevel::WARN); LogTopic Logger::V8("v8", LogLevel::WARN); +LogTopic Logger::VIEWS("views", LogLevel::FATAL); #ifdef USE_ENTERPRISE LogTopic AuditFeature::AUDIT_AUTHENTICATION("audit-authentication", LogLevel::INFO); @@ -117,7 +118,7 @@ LogTopic* LogTopic::lookup(std::string const& name) { return it->second; } - + std::string LogTopic::lookup(size_t topicId) { MUTEX_LOCKER(guard, _namesLock); diff --git a/lib/Logger/Logger.h b/lib/Logger/Logger.h index 898036a55d..fd9a171edc 100644 --- a/lib/Logger/Logger.h +++ b/lib/Logger/Logger.h @@ -153,6 +153,7 @@ class Logger { static LogTopic THREADS; static LogTopic TRANSACTIONS; static LogTopic V8; + static LogTopic VIEWS; public: struct FIXED { @@ -161,11 +162,11 @@ class Logger { double _value; int _precision; }; - + struct BINARY { BINARY(void const* baseAddress, size_t size) : baseAddress(baseAddress), size(size){} - explicit BINARY(std::string const& data) : BINARY(data.c_str(), data.size()) {} + explicit BINARY(std::string const& data) : BINARY(data.c_str(), data.size()) {} void const* baseAddress; size_t size; };