diff options
author | Zdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com> | 2009-04-29 12:46:18 +0200 |
---|---|---|
committer | Zdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com> | 2009-04-29 12:46:18 +0200 |
commit | 1e752b178131fa0268151219deb35e09c40e29bc (patch) | |
tree | 0b6bbed34179f605d7e6759211a010edea19f9d5 /lib/MiddleWare | |
parent | 52291c1024050d25967b5640b04d67166b7728d2 (diff) | |
download | abrt-1e752b178131fa0268151219deb35e09c40e29bc.tar.gz abrt-1e752b178131fa0268151219deb35e09c40e29bc.tar.xz abrt-1e752b178131fa0268151219deb35e09c40e29bc.zip |
rework commlayerinner usage
new lock method in debugdump
Diffstat (limited to 'lib/MiddleWare')
-rw-r--r-- | lib/MiddleWare/Makefile.am | 2 | ||||
-rw-r--r-- | lib/MiddleWare/MiddleWare.cpp | 26 | ||||
-rw-r--r-- | lib/MiddleWare/PluginManager.cpp | 16 |
3 files changed, 20 insertions, 24 deletions
diff --git a/lib/MiddleWare/Makefile.am b/lib/MiddleWare/Makefile.am index d29b9137..1023aa06 100644 --- a/lib/MiddleWare/Makefile.am +++ b/lib/MiddleWare/Makefile.am @@ -8,7 +8,7 @@ libABRTMiddleWare_la_SOURCES = MiddleWare.cpp MiddleWare.h PluginManager.cpp \ Reporter.h Analyzer.h libABRTMiddleWare_la_LIBADD = $(DL_LIBS) ../Utils/libABRTUtils.la $(RPM_LIBS) libABRTMiddleWare_la_LDFLAGS = -version-info 0:1:0 -libABRTMiddleWare_la_CPPFLAGS = -I$(srcdir)/../../inc -I$(srcdir)/../Utils $(RPM_CFLAGS) +libABRTMiddleWare_la_CPPFLAGS = -I$(srcdir)/../../inc -I$(srcdir)/../Utils -I$(srcdir)/../CommLayer $(RPM_CFLAGS) check_PROGRAMS = test test_SOURCES = test.cpp diff --git a/lib/MiddleWare/MiddleWare.cpp b/lib/MiddleWare/MiddleWare.cpp index bed81bbf..03285ee7 100644 --- a/lib/MiddleWare/MiddleWare.cpp +++ b/lib/MiddleWare/MiddleWare.cpp @@ -22,7 +22,7 @@ #include "MiddleWare.h" #include "DebugDump.h" #include "ABRTException.h" -#include <iostream> +#include "CommLayerInner.h" CMiddleWare::CMiddleWare(const std::string& pPlugisConfDir, const std::string& pPlugisLibDir) : @@ -178,7 +178,7 @@ int CMiddleWare::CreateCrashReport(const std::string& pUUID, { DeleteCrashInfo(row.m_sUUID, row.m_sUID, false); } - std::cerr << "CMiddleWare::CreateCrashReport(): " << e.what() << std::endl; + comm_layer_inner_warning("CMiddleWare::CreateCrashReport(): " + e.what()); return 0; } @@ -189,14 +189,7 @@ void CMiddleWare::Report(const std::string& pDebugDumpDir) { map_crash_report_t crashReport; - try - { - DebugDumpToCrashReport(pDebugDumpDir, crashReport); - } - catch (CABRTException& e) - { - std::cerr << "CMiddleWare::Report(): " << e.what() << std::endl; - } + DebugDumpToCrashReport(pDebugDumpDir, crashReport); set_reporters_t::iterator it_r; for (it_r = m_setReporters.begin(); it_r != m_setReporters.end(); it_r++) @@ -208,7 +201,8 @@ void CMiddleWare::Report(const std::string& pDebugDumpDir) } catch (CABRTException& e) { - std::cerr << "CMiddleWare::Report(): " << e.what() << std::endl; + comm_layer_inner_warning("CMiddleWare::Report(): " + e.what()); + comm_layer_inner_status("Reporting via '"+(*it_r).first+"' was not successful: " + e.what()); } } } @@ -239,7 +233,8 @@ void CMiddleWare::Report(const map_crash_report_t& pCrashReport) } catch (CABRTException& e) { - std::cerr << "CMiddleWare::Report(): " << e.what() << std::endl; + comm_layer_inner_warning("CMiddleWare::Report(): " + e.what()); + comm_layer_inner_status("Reporting via '"+(*it_r).first+"' was not successful: " + e.what()); } } } @@ -357,7 +352,8 @@ void CMiddleWare::RunAnalyzerActions(const std::string& pAnalyzer, const std::st } catch (CABRTException& e) { - std::cerr << "CMiddleWare::RunAnalyzerActions(): " << e.what() << std::endl; + comm_layer_inner_warning("CMiddleWare::RunAnalyzerActions(): " + e.what()); + comm_layer_inner_status("Action performed by '"+(*it_a).first+"' was not successful: " + e.what()); } } } @@ -435,7 +431,7 @@ int CMiddleWare::SaveDebugDump(const std::string& pDebugDumpDir, map_crash_info_ { DeleteDebugDumpDir(pDebugDumpDir); } - std::cerr << "CMiddleWare::SaveDebugDump(): " << e.what() << std::endl; + comm_layer_inner_warning("CMiddleWare::SaveDebugDump(): " + e.what()); return 0; } } @@ -461,7 +457,7 @@ map_crash_info_t CMiddleWare::GetCrashInfo(const std::string& pUUID, { DeleteCrashInfo(row.m_sUUID, row.m_sUID, false); } - std::cerr << "CMiddleWare::GetCrashInfo(): " << e.what() << std::endl; + comm_layer_inner_warning("CMiddleWare::GetCrashInfo(): " + e.what()); return crashInfo; } diff --git a/lib/MiddleWare/PluginManager.cpp b/lib/MiddleWare/PluginManager.cpp index 8b01f478..48560e4d 100644 --- a/lib/MiddleWare/PluginManager.cpp +++ b/lib/MiddleWare/PluginManager.cpp @@ -22,7 +22,7 @@ #include <iostream> #include "PluginManager.h" #include "ABRTException.h" -#include "ABRTCommLayer.h" +#include "CommLayerInner.h" #include <dirent.h> #include <stdio.h> #include <sys/types.h> @@ -84,7 +84,7 @@ void CPluginManager::LoadPlugin(const std::string& pName) { throw CABRTException(EXCEP_PLUGIN, "CPluginManager::LoadPlugin(): non-compatible plugin"); } - ABRTCommLayer::debug("Plugin " + pName + " (" + abrtPlugin->GetVersion() + ") succesfully loaded."); + comm_layer_inner_debug("Plugin " + pName + " (" + abrtPlugin->GetVersion() + ") succesfully loaded."); m_mapABRTPlugins[pName] = abrtPlugin; } catch (CABRTException& e) @@ -93,8 +93,8 @@ void CPluginManager::LoadPlugin(const std::string& pName) { delete abrtPlugin; } - ABRTCommLayer::warning("CPluginManager::LoadPlugin(): " + e.what()); - ABRTCommLayer::warning("Failed to load plugin " + pName); + comm_layer_inner_warning("CPluginManager::LoadPlugin(): " + e.what()); + comm_layer_inner_warning("Failed to load plugin " + pName); } } } @@ -106,7 +106,7 @@ void CPluginManager::UnLoadPlugin(const std::string& pName) UnRegisterPlugin(pName); delete m_mapABRTPlugins[pName]; m_mapABRTPlugins.erase(pName); - ABRTCommLayer::debug("Plugin " + pName + " sucessfully unloaded."); + comm_layer_inner_debug("Plugin " + pName + " sucessfully unloaded."); } } @@ -126,14 +126,14 @@ void CPluginManager::RegisterPlugin(const std::string& pName) } catch (std::string sError) { - ABRTCommLayer::warning("Can not initialize plugin " + pName + "(" + comm_layer_inner_warning("Can not initialize plugin " + pName + "(" + std::string(plugin_type_str_t[m_mapABRTPlugins[pName]->GetType()]) + ")"); UnLoadPlugin(pName); return; } m_mapPlugins[pName] = plugin; - ABRTCommLayer::debug("Registred plugin " + pName + "(" + comm_layer_inner_debug("Registred plugin " + pName + "(" + std::string(plugin_type_str_t[m_mapABRTPlugins[pName]->GetType()]) + ")"); } @@ -149,7 +149,7 @@ void CPluginManager::UnRegisterPlugin(const std::string& pName) m_mapPlugins[pName]->DeInit(); delete m_mapPlugins[pName]; m_mapPlugins.erase(pName); - ABRTCommLayer::debug("UnRegistred plugin " + pName + "(" + comm_layer_inner_debug("UnRegistred plugin " + pName + "(" + std::string(plugin_type_str_t[m_mapABRTPlugins[pName]->GetType()]) + ")"); } |