diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-10-02 23:28:59 +0400 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-10-02 23:28:59 +0400 |
commit | 3bab2676ec05ebd1f3d031c4fcdf7512412ccf05 (patch) | |
tree | 95a484e2981461b10f4371d4b45573890804c04f /external/easylogging++ | |
parent | Merge pull request #2506 (diff) | |
parent | Log categories can now be added to and removed from (diff) | |
download | monero-3bab2676ec05ebd1f3d031c4fcdf7512412ccf05.tar.xz |
Merge pull request #2512
792ba4f0 Log categories can now be added to and removed from (moneromooo-monero)
48f92eb6 easylogging++: add categories getter (moneromooo-monero)
f35afe62 epee: factor log level/categories setting (moneromooo-monero)
Diffstat (limited to 'external/easylogging++')
-rw-r--r-- | external/easylogging++/easylogging++.cc | 16 | ||||
-rw-r--r-- | external/easylogging++/easylogging++.h | 5 |
2 files changed, 20 insertions, 1 deletions
diff --git a/external/easylogging++/easylogging++.cc b/external/easylogging++/easylogging++.cc index 721b2af15..6bc6b2619 100644 --- a/external/easylogging++/easylogging++.cc +++ b/external/easylogging++/easylogging++.cc @@ -1961,8 +1961,13 @@ void VRegistry::setCategories(const char* categories, bool clear) { m_categories.push_back(std::make_pair(ss.str(), level)); }; - if (clear) + if (clear) { m_categories.clear(); + m_categoriesString.clear(); + } + if (!m_categoriesString.empty()) + m_categoriesString += ","; + m_categoriesString += categories; if (!categories) 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... static int priority(Level level) { if (level == Level::Fatal) return 0; @@ -3073,6 +3083,10 @@ void Loggers::setCategories(const char* categories, bool clear) { ELPP->vRegistry()->setCategories(categories, clear); } +std::string Loggers::getCategories() { + return ELPP->vRegistry()->getCategories(); +} + void Loggers::clearCategories(void) { ELPP->vRegistry()->clearCategories(); } diff --git a/external/easylogging++/easylogging++.h b/external/easylogging++/easylogging++.h index 8f592899e..c55cce755 100644 --- a/external/easylogging++/easylogging++.h +++ b/external/easylogging++/easylogging++.h @@ -2488,6 +2488,8 @@ class VRegistry : base::NoCopy, public base::threading::ThreadSafe { void setCategories(const char* categories, bool clear = true); + std::string getCategories(); + void setModules(const char* modules); bool allowed(Level level, const char* category); @@ -2518,6 +2520,7 @@ class VRegistry : base::NoCopy, public base::threading::ThreadSafe { base::type::EnumType* m_pFlags; std::map<std::string, base::type::VerboseLevel> m_modules; std::deque<std::pair<std::string, Level>> m_categories; + std::string m_categoriesString; std::string m_filenameCommonPrefix; }; } // namespace base @@ -3953,6 +3956,8 @@ class Loggers : base::StaticClass { static void setVModules(const char* modules); /// @brief Sets categories as specified (on the fly) static void setCategories(const char* categories, bool clear = true); + /// @brief Gets current categories + static std::string getCategories(); /// @brief Clears vmodules static void clearVModules(void); /// @brief Clears categories |