mirror of https://gitee.com/bigwinds/arangodb
Made LoggerView log to VIEWS topic and fixed level bug.
This commit is contained in:
parent
ee1c60c67a
commit
5f87674b6f
|
@ -69,11 +69,22 @@ static std::string LevelEnumToString(LogLevel level) {
|
|||
}
|
||||
}
|
||||
|
||||
#define VIEW_LOG_TOPIC(a) \
|
||||
!arangodb::Logger::isEnabled(static_cast<arangodb::LogLevel>(a), \
|
||||
Logger::VIEWS) \
|
||||
? (void)0 \
|
||||
: arangodb::LogVoidify() & (arangodb::LoggerStream() \
|
||||
<< static_cast<arangodb::LogLevel>(a) \
|
||||
<< Logger::VIEWS \
|
||||
<< arangodb::Logger::LINE(__LINE__) \
|
||||
<< arangodb::Logger::FILE(__FILE__) \
|
||||
<< arangodb::Logger::FUNCTION(__FUNCTION__))
|
||||
|
||||
std::string LoggerView::type("logger");
|
||||
|
||||
std::unique_ptr<ViewImplementation> 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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue