diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-10-07 16:10:18 +0200 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-10-07 16:10:18 +0200 |
commit | d4417a9c57a7391233bb7765cf1cac2561e24796 (patch) | |
tree | 341b71286ba5e860782741afbc450cd26a88c45d | |
parent | c817c1ada5084b06e2c7838c58b339a47ae8fcf4 (diff) | |
download | abrt-d4417a9c57a7391233bb7765cf1cac2561e24796.tar.gz abrt-d4417a9c57a7391233bb7765cf1cac2561e24796.tar.xz abrt-d4417a9c57a7391233bb7765cf1cac2561e24796.zip |
add more logging about settings, and make it possible to load them from stdin
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
-rw-r--r-- | lib/utils/Plugin.cpp | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/lib/utils/Plugin.cpp b/lib/utils/Plugin.cpp index 40fa39de..da55bdbf 100644 --- a/lib/utils/Plugin.cpp +++ b/lib/utils/Plugin.cpp @@ -28,19 +28,43 @@ void CPlugin::DeInit() {} void CPlugin::SetSettings(const map_plugin_settings_t& pSettings) { m_pSettings = pSettings; + VERB3 + { + log("SetSettings:"); + map_plugin_settings_t::const_iterator it = m_pSettings.begin(); + while (it != m_pSettings.end()) + { + log(" settings[%s]='%s'", it->first.c_str(), it->second.c_str()); + it++; + } + } } const map_plugin_settings_t& CPlugin::GetSettings() { + VERB3 + { + log("GetSettings:"); + map_plugin_settings_t::const_iterator it = m_pSettings.begin(); + while (it != m_pSettings.end()) + { + log(" settings[%s]:'%s'", it->first.c_str(), it->second.c_str()); + it++; + } + } return m_pSettings; } bool LoadPluginSettings(const char *pPath, map_plugin_settings_t& pSettings, bool skipKeysWithoutValue /*= true*/) { - FILE *fp = fopen(pPath, "r"); - if (!fp) - return false; + FILE *fp = stdin; + if (strcmp(pPath, "-") != 0) + { + fp = fopen(pPath, "r"); + if (!fp) + return false; + } char line[512]; while (fgets(line, sizeof(line), fp)) @@ -99,6 +123,7 @@ bool LoadPluginSettings(const char *pPath, map_plugin_settings_t& pSettings, pSettings[key] = value; } - fclose(fp); + if (fp != stdin) + fclose(fp); return true; } |