diff options
| author | Spp <spp@jorge.gr> | 2013-11-07 16:34:44 +0100 |
|---|---|---|
| committer | Spp <spp@jorge.gr> | 2013-11-07 16:34:44 +0100 |
| commit | 8aa9745c4c7e80ffcbbd3f2377125ad08b30b661 (patch) | |
| tree | 824a43c64f1778ed1bcad62a24137262473464f5 /src/server/shared/Configuration | |
| parent | d26bb8517c6030139b0383659fede9628abac22c (diff) | |
Core/Logging: Extend logging system to allow inheritance of loggers
- Changed default loggers and appenders
- '.' determines the relation between loggers ("type.subtype" inherits "type" logger setting if logger "type.subtype" is not defined)
- When core logs a message it search for the correct logger (root is the default one)
ie: a message logged with "type.subtype"
* Core will try to find a logger with name "type.subtype", if its not found then will search for "type", again if its not found it will return the default one "root"
Diffstat (limited to 'src/server/shared/Configuration')
| -rw-r--r-- | src/server/shared/Configuration/Config.cpp | 32 | ||||
| -rw-r--r-- | src/server/shared/Configuration/Config.h | 3 |
2 files changed, 34 insertions, 1 deletions
diff --git a/src/server/shared/Configuration/Config.cpp b/src/server/shared/Configuration/Config.cpp index 47d59a57100..055c33b40ee 100644 --- a/src/server/shared/Configuration/Config.cpp +++ b/src/server/shared/Configuration/Config.cpp @@ -117,3 +117,35 @@ std::string const& ConfigMgr::GetFilename() GuardType guard(_configLock); return _filename; } + +std::list<std::string> ConfigMgr::GetKeysByString(std::string const& name) +{ + GuardType guard(_configLock); + + std::list<std::string> keys; + if (_config.get() == 0) + return keys; + + ACE_TString section_name; + ACE_Configuration_Section_Key section_key; + const ACE_Configuration_Section_Key &root_key = _config->root_section(); + + int i = 0; + while (_config->enumerate_sections(root_key, i++, section_name) == 0) + { + _config->open_section(root_key, section_name.c_str(), 0, section_key); + + ACE_TString key_name; + ACE_Configuration::VALUETYPE type; + int j = 0; + while (_config->enumerate_values(section_key, j++, key_name, type) == 0) + { + std::string temp = key_name.c_str(); + + if (!temp.find(name)) + keys.push_back(temp); + } + } + + return keys; +} diff --git a/src/server/shared/Configuration/Config.h b/src/server/shared/Configuration/Config.h index d633e37f0c4..49f5c5e07fb 100644 --- a/src/server/shared/Configuration/Config.h +++ b/src/server/shared/Configuration/Config.h @@ -20,7 +20,7 @@ #define CONFIG_H #include <string> -#include <map> +#include <list> #include <ace/Singleton.h> #include <ace/Configuration_Import_Export.h> #include <ace/Thread_Mutex.h> @@ -56,6 +56,7 @@ public: float GetFloatDefault(const char* name, float def); std::string const& GetFilename(); + std::list<std::string> GetKeysByString(std::string const& name); private: bool GetValueHelper(const char* name, ACE_TString &result); |
