easylogging++: add categories getter
This commit is contained in:
parent
f35afe62a4
commit
48f92eb665
16
external/easylogging++/easylogging++.cc
vendored
16
external/easylogging++/easylogging++.cc
vendored
@ -1961,8 +1961,13 @@ void VRegistry::setCategories(const char* categories, bool clear) {
|
|||||||
m_categories.push_back(std::make_pair(ss.str(), level));
|
m_categories.push_back(std::make_pair(ss.str(), level));
|
||||||
};
|
};
|
||||||
|
|
||||||
if (clear)
|
if (clear) {
|
||||||
m_categories.clear();
|
m_categories.clear();
|
||||||
|
m_categoriesString.clear();
|
||||||
|
}
|
||||||
|
if (!m_categoriesString.empty())
|
||||||
|
m_categoriesString += ",";
|
||||||
|
m_categoriesString += categories;
|
||||||
if (!categories)
|
if (!categories)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -2001,6 +2006,11 @@ void VRegistry::setCategories(const char* categories, bool clear) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string VRegistry::getCategories() {
|
||||||
|
base::threading::ScopedLock scopedLock(lock());
|
||||||
|
return m_categoriesString;
|
||||||
|
}
|
||||||
|
|
||||||
// Log levels are sorted in a weird way...
|
// Log levels are sorted in a weird way...
|
||||||
static int priority(Level level) {
|
static int priority(Level level) {
|
||||||
if (level == Level::Fatal) return 0;
|
if (level == Level::Fatal) return 0;
|
||||||
@ -3073,6 +3083,10 @@ void Loggers::setCategories(const char* categories, bool clear) {
|
|||||||
ELPP->vRegistry()->setCategories(categories, clear);
|
ELPP->vRegistry()->setCategories(categories, clear);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Loggers::getCategories() {
|
||||||
|
return ELPP->vRegistry()->getCategories();
|
||||||
|
}
|
||||||
|
|
||||||
void Loggers::clearCategories(void) {
|
void Loggers::clearCategories(void) {
|
||||||
ELPP->vRegistry()->clearCategories();
|
ELPP->vRegistry()->clearCategories();
|
||||||
}
|
}
|
||||||
|
5
external/easylogging++/easylogging++.h
vendored
5
external/easylogging++/easylogging++.h
vendored
@ -2488,6 +2488,8 @@ class VRegistry : base::NoCopy, public base::threading::ThreadSafe {
|
|||||||
|
|
||||||
void setCategories(const char* categories, bool clear = true);
|
void setCategories(const char* categories, bool clear = true);
|
||||||
|
|
||||||
|
std::string getCategories();
|
||||||
|
|
||||||
void setModules(const char* modules);
|
void setModules(const char* modules);
|
||||||
|
|
||||||
bool allowed(Level level, const char* category);
|
bool allowed(Level level, const char* category);
|
||||||
@ -2518,6 +2520,7 @@ class VRegistry : base::NoCopy, public base::threading::ThreadSafe {
|
|||||||
base::type::EnumType* m_pFlags;
|
base::type::EnumType* m_pFlags;
|
||||||
std::map<std::string, base::type::VerboseLevel> m_modules;
|
std::map<std::string, base::type::VerboseLevel> m_modules;
|
||||||
std::deque<std::pair<std::string, Level>> m_categories;
|
std::deque<std::pair<std::string, Level>> m_categories;
|
||||||
|
std::string m_categoriesString;
|
||||||
std::string m_filenameCommonPrefix;
|
std::string m_filenameCommonPrefix;
|
||||||
};
|
};
|
||||||
} // namespace base
|
} // namespace base
|
||||||
@ -3953,6 +3956,8 @@ class Loggers : base::StaticClass {
|
|||||||
static void setVModules(const char* modules);
|
static void setVModules(const char* modules);
|
||||||
/// @brief Sets categories as specified (on the fly)
|
/// @brief Sets categories as specified (on the fly)
|
||||||
static void setCategories(const char* categories, bool clear = true);
|
static void setCategories(const char* categories, bool clear = true);
|
||||||
|
/// @brief Gets current categories
|
||||||
|
static std::string getCategories();
|
||||||
/// @brief Clears vmodules
|
/// @brief Clears vmodules
|
||||||
static void clearVModules(void);
|
static void clearVModules(void);
|
||||||
/// @brief Clears categories
|
/// @brief Clears categories
|
||||||
|
Loading…
Reference in New Issue
Block a user