summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Plugins/Bugzilla.cpp16
-rw-r--r--lib/Plugins/CCpp.cpp2
-rw-r--r--lib/Plugins/FileTransfer.cpp10
-rw-r--r--lib/Plugins/KerneloopsScanner.cpp14
-rw-r--r--src/Daemon/CommLayerServerDBus.cpp4
-rw-r--r--src/Daemon/CommLayerServerSocket.cpp17
-rw-r--r--src/Daemon/CrashWatcher.cpp11
-rw-r--r--src/Daemon/CrashWatcher.h2
-rw-r--r--src/Daemon/Daemon.cpp25
-rw-r--r--src/Daemon/MiddleWare.cpp20
-rw-r--r--src/Daemon/MiddleWare.h2
-rw-r--r--src/Daemon/PluginManager.cpp22
12 files changed, 63 insertions, 82 deletions
diff --git a/lib/Plugins/Bugzilla.cpp b/lib/Plugins/Bugzilla.cpp
index 527a9bd6..b92aa157 100644
--- a/lib/Plugins/Bugzilla.cpp
+++ b/lib/Plugins/Bugzilla.cpp
@@ -1,11 +1,12 @@
-#include "Bugzilla.h"
+
#include <xmlrpc-c/base.hpp>
+#include <sstream>
+#include "abrtlib.h"
+#include "Bugzilla.h"
#include "CrashTypes.h"
#include "DebugDump.h"
#include "ABRTException.h"
#include "CommLayerInner.h"
-#include <sstream>
-#include <string.h>
#define XML_RPC_SUFFIX "/xmlrpc.cgi"
@@ -65,7 +66,6 @@ PRInt32 CReporterBugzilla::Base64Encode_cb(void *arg, const char *obuf, PRInt32
return 1;
}
-
void CReporterBugzilla::Login()
{
xmlrpc_c::paramList paramList;
@@ -81,7 +81,7 @@ void CReporterBugzilla::Login()
ret = xmlrpc_c::value_struct(rpc->getResult());
std::stringstream ss;
ss << xmlrpc_c::value_int(ret["id"]);
- comm_layer_inner_debug("Login id: " + ss.str());
+ log("Login id: %s", ss.str().c_str());
}
catch (std::exception& e)
{
@@ -214,7 +214,7 @@ std::string CReporterBugzilla::CheckUUIDInBugzilla(const std::string& pComponent
bug = xmlrpc_c::value_struct(bugs[0]);
ss << xmlrpc_c::value_int(bug["bug_id"]);
- comm_layer_inner_debug("Bug is already reported: " + ss.str());
+ log("Bug is already reported: %s", ss.str().c_str());
comm_layer_inner_status("Bug is already reported: " + ss.str());
if (!CheckCCAndReporter(ss.str()))
@@ -342,7 +342,7 @@ std::string CReporterBugzilla::NewBug(const map_crash_report_t& pCrashReport)
rpc->call(m_pXmlrpcClient, m_pCarriageParm);
ret = xmlrpc_c::value_struct(rpc->getResult());
bugId << xmlrpc_c::value_int(ret["id"]);
- comm_layer_inner_debug("New bug id: " + bugId.str());
+ log("New bug id: %s", bugId.str().c_str());
comm_layer_inner_status("New bug id: " + bugId.str());
}
catch (std::exception& e)
@@ -388,7 +388,7 @@ void CReporterBugzilla::AddAttachments(const std::string& pBugId, const map_cras
ret = xmlrpc_c::value_array(rpc->getResult()).vectorValueValue();
std::stringstream ss;
ss << xmlrpc_c::value_int(ret[0]);
- comm_layer_inner_debug("New attachment id: " + ss.str());
+ log("New attachment id: %s", ss.str().c_str());
}
catch (std::exception& e)
{
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp
index ddf76967..b9fcb215 100644
--- a/lib/Plugins/CCpp.cpp
+++ b/lib/Plugins/CCpp.cpp
@@ -140,7 +140,7 @@ static void InstallDebugInfos(const std::string& pPackage)
if (last >= 0 && buff[last] == '\n')
buff[last] = '\0';
- comm_layer_inner_debug(buff);
+ log(buff);
comm_layer_inner_status(buff);
#ifdef COMPLAIN_IF_NO_DEBUGINFO
diff --git a/lib/Plugins/FileTransfer.cpp b/lib/Plugins/FileTransfer.cpp
index d3d09969..4ed9a236 100644
--- a/lib/Plugins/FileTransfer.cpp
+++ b/lib/Plugins/FileTransfer.cpp
@@ -19,17 +19,13 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "FileTransfer.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
#include <iostream>
#include <sstream>
#include <fstream>
#include <curl/curl.h>
+#include "abrtlib.h"
+#include "FileTransfer.h"
#include "DebugDump.h"
#include "ABRTException.h"
#include "CommLayerInner.h"
@@ -141,7 +137,7 @@ void CFileTransfer::CreateArchive(const std::string& pArchiveName,
throw CABRTException(EXCEP_PLUGIN, "CFileTransfer::CreateArchive(): unknown/unsupported archive type "+m_sArchiveType);
}
- comm_layer_inner_debug(cmdline);
+ log("Executing '%s'", cmdline.c_str());
result = system(cmdline.c_str());
if( result != 0 )
diff --git a/lib/Plugins/KerneloopsScanner.cpp b/lib/Plugins/KerneloopsScanner.cpp
index 6c7ddffc..77a62246 100644
--- a/lib/Plugins/KerneloopsScanner.cpp
+++ b/lib/Plugins/KerneloopsScanner.cpp
@@ -24,16 +24,14 @@
* Arjan van de Ven <arjan@linux.intel.com>
*/
+#include <assert.h>
+#include <syslog.h>
+#include <asm/unistd.h> /* __NR_syslog */
#include "abrtlib.h"
-
-#include "KerneloopsScanner.h"
#include "DebugDump.h"
#include "ABRTException.h"
#include "CommLayerInner.h"
-
-#include <assert.h>
-#include <syslog.h>
-#include <asm/unistd.h>
+#include "KerneloopsScanner.h"
#define FILENAME_KERNELOOPS "kerneloops"
@@ -112,7 +110,7 @@ void CKerneloopsScanner::SaveOopsToDebugDump()
int CKerneloopsScanner::ScanDmesg()
{
- comm_layer_inner_debug("Scanning dmesg...");
+ log("Scanning dmesg...");
int cnt_FoundOopses;
char *buffer;
@@ -129,7 +127,7 @@ int CKerneloopsScanner::ScanDmesg()
int CKerneloopsScanner::ScanSysLogFile(const char *filename)
{
- comm_layer_inner_debug("Scanning syslog...");
+ log("Scanning syslog...");
char *buffer;
struct stat statb;
diff --git a/src/Daemon/CommLayerServerDBus.cpp b/src/Daemon/CommLayerServerDBus.cpp
index db78cd38..022d4805 100644
--- a/src/Daemon/CommLayerServerDBus.cpp
+++ b/src/Daemon/CommLayerServerDBus.cpp
@@ -1,7 +1,7 @@
-#include "abrtlib.h"
-#include "CommLayerServerDBus.h"
#include <iostream>
+#include "abrtlib.h"
#include "ABRTException.h"
+#include "CommLayerServerDBus.h"
void attach_dbus_dispatcher_to_glib_main_context()
{
diff --git a/src/Daemon/CommLayerServerSocket.cpp b/src/Daemon/CommLayerServerSocket.cpp
index 734c5a18..1b540686 100644
--- a/src/Daemon/CommLayerServerSocket.cpp
+++ b/src/Daemon/CommLayerServerSocket.cpp
@@ -1,15 +1,12 @@
-#include "CommLayerServerSocket.h"
-#include "CommLayerInner.h"
-#include "ABRTException.h"
-#include "CrashTypesSocket.h"
-#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <iostream>
#include <sstream>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
+#include "abrtlib.h"
+#include "CommLayerInner.h"
+#include "ABRTException.h"
+#include "CrashTypesSocket.h"
+#include "CommLayerServerSocket.h"
void CCommLayerServerSocket::Send(const std::string& pData, GIOChannel *pDestination)
{
@@ -66,7 +63,7 @@ gboolean CCommLayerServerSocket::client_socket_cb(GIOChannel *source, GIOConditi
condition & G_IO_ERR ||
condition & G_IO_NVAL)
{
- comm_layer_inner_debug("Socket client disconnected.");
+ log("Socket client disconnected");
g_io_channel_unref(serverSocket->m_mapClientChannels[g_io_channel_unix_get_fd(source)]);
serverSocket->m_mapClientChannels.erase(g_io_channel_unix_get_fd(source));
return FALSE;
@@ -116,7 +113,7 @@ gboolean CCommLayerServerSocket::server_socket_cb(GIOChannel *source, GIOConditi
comm_layer_inner_warning("Server can not accept client.");
return TRUE;
}
- comm_layer_inner_debug("New socket client connected.");
+ log("New socket client connected");
GIOChannel* gSocket = g_io_channel_unix_new(socket);
if (!g_io_add_watch(gSocket,
static_cast<GIOCondition>(G_IO_IN |G_IO_PRI| G_IO_ERR | G_IO_HUP | G_IO_NVAL),
diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp
index f0593c1c..ffc71338 100644
--- a/src/Daemon/CrashWatcher.cpp
+++ b/src/Daemon/CrashWatcher.cpp
@@ -24,7 +24,7 @@
void CCrashWatcher::Status(const std::string& pMessage, const std::string& pDest)
{
- std::cout << "Update: " + pMessage << std::endl;
+ log("Update: %s", pMessage.c_str());
//FIXME: send updates only to job owner
if (g_pCommLayer != NULL)
g_pCommLayer->Update(pDest, pMessage);
@@ -32,15 +32,14 @@ void CCrashWatcher::Status(const std::string& pMessage, const std::string& pDest
void CCrashWatcher::Warning(const std::string& pMessage)
{
- std::cerr << "Warning: " + pMessage << std::endl;
+ log("Warning: %s", pMessage.c_str());
if (g_pCommLayer != NULL)
g_pCommLayer->Warning(pMessage);
}
void CCrashWatcher::Debug(const std::string& pMessage)
{
- //some logic to add logging levels?
- std::cout << "Debug: " + pMessage << std::endl;
+ log("Debug: %s", pMessage.c_str());
}
CCrashWatcher::CCrashWatcher()
@@ -55,7 +54,7 @@ CCrashWatcher::~CCrashWatcher()
vector_crash_infos_t CCrashWatcher::GetCrashInfos(const std::string &pUID)
{
vector_crash_infos_t retval;
- Debug("Getting crash infos...");
+ log("Getting crash infos...");
try
{
vector_pair_string_string_t UUIDsUIDs;
@@ -117,7 +116,7 @@ static void *create_report(void *arg)
{
thread_data_t *thread_data = (thread_data_t *) arg;
map_crash_info_t crashReport;
- g_cw->Debug("Creating report...");
+ log("Creating report...");
try
{
mw_result_t res;
diff --git a/src/Daemon/CrashWatcher.h b/src/Daemon/CrashWatcher.h
index ac12911b..b22577c2 100644
--- a/src/Daemon/CrashWatcher.h
+++ b/src/Daemon/CrashWatcher.h
@@ -67,7 +67,7 @@ class CCrashWatcher
};
-/* used only for ->Debug(), ->Warning() etc calls */
+/* used only for ->Warning() calls */
extern CCrashWatcher *g_cw;
/* conduit for these messages */
extern CCommLayerServer *g_pCommLayer;
diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp
index 81484d16..bf5215dd 100644
--- a/src/Daemon/Daemon.cpp
+++ b/src/Daemon/Daemon.cpp
@@ -117,7 +117,7 @@ static void cron_delete_callback_data_cb(gpointer data)
static gboolean cron_activation_periodic_cb(gpointer data)
{
cron_callback_data_t* cronPeriodicCallbackData = static_cast<cron_callback_data_t*>(data);
- g_cw->Debug("Activating plugin: " + cronPeriodicCallbackData->m_sPluginName);
+ log("Activating plugin: %s", cronPeriodicCallbackData->m_sPluginName.c_str());
RunAction(DEBUG_DUMPS_DIR,
cronPeriodicCallbackData->m_sPluginName,
cronPeriodicCallbackData->m_sPluginArgs);
@@ -126,7 +126,7 @@ static gboolean cron_activation_periodic_cb(gpointer data)
static gboolean cron_activation_one_cb(gpointer data)
{
cron_callback_data_t* cronOneCallbackData = static_cast<cron_callback_data_t*>(data);
- g_cw->Debug("Activating plugin: " + cronOneCallbackData->m_sPluginName);
+ log("Activating plugin: %s", cronOneCallbackData->m_sPluginName.c_str());
RunAction(DEBUG_DUMPS_DIR,
cronOneCallbackData->m_sPluginName,
cronOneCallbackData->m_sPluginArgs);
@@ -135,7 +135,7 @@ static gboolean cron_activation_one_cb(gpointer data)
static gboolean cron_activation_reshedule_cb(gpointer data)
{
cron_callback_data_t* cronResheduleCallbackData = static_cast<cron_callback_data_t*>(data);
- g_cw->Debug("Rescheduling plugin: " + cronResheduleCallbackData->m_sPluginName);
+ log("Rescheduling plugin: %s", cronResheduleCallbackData->m_sPluginName.c_str());
cron_callback_data_t* cronPeriodicCallbackData = new cron_callback_data_t(cronResheduleCallbackData->m_sPluginName,
cronResheduleCallbackData->m_sPluginArgs,
cronResheduleCallbackData->m_nTimeout);
@@ -274,7 +274,7 @@ static void SetUpCron()
static void FindNewDumps(const std::string& pPath)
{
- g_cw->Debug("Scanning for unsaved entries...");
+ log("Scanning for unsaved entries...");
struct dirent *ep;
struct stat stats;
DIR *dp;
@@ -313,11 +313,11 @@ static void FindNewDumps(const std::string& pPath)
switch (res)
{
case MW_OK:
- g_cw->Debug("Saving into database (" + *itt + ").");
+ log("Saving into database (%s)", itt->c_str());
RunActionsAndReporters(crashinfo[CD_MWDDD][CD_CONTENT]);
break;
case MW_IN_DB:
- g_cw->Debug("Already saved in database (" + *itt + ").");
+ log("Already saved in database (%s)", itt->c_str());
break;
case MW_REPORTED:
case MW_OCCURED:
@@ -449,7 +449,7 @@ static gboolean handle_event_cb(GIOChannel *gio, GIOCondition condition, gpointe
name = &buf[i] + sizeof (struct inotify_event);
i += sizeof (struct inotify_event) + event->len;
- g_cw->Debug(std::string("Created file: ") + name);
+ log("Created file: %s", name);
/* we want to ignore the lock files */
if (event->mask & IN_ISDIR)
@@ -465,7 +465,7 @@ static gboolean handle_event_cb(GIOChannel *gio, GIOCondition condition, gpointe
switch (res)
{
case MW_OK:
- g_cw->Debug("New crash, saving...");
+ log("New crash, saving...");
RunActionsAndReporters(crashinfo[CD_MWDDD][CD_CONTENT]);
/* send message to dbus */
g_pCommLayer->Crash(crashinfo[CD_PACKAGE][CD_CONTENT]);
@@ -473,7 +473,7 @@ static gboolean handle_event_cb(GIOChannel *gio, GIOCondition condition, gpointe
case MW_REPORTED:
case MW_OCCURED:
/* send message to dbus */
- g_cw->Debug("Already saved crash, deleting...");
+ log("Already saved crash, deleting...");
g_pCommLayer->Crash(crashinfo[CD_PACKAGE][CD_CONTENT]);
DeleteDebugDumpDir(std::string(DEBUG_DUMPS_DIR) + "/" + name);
break;
@@ -506,13 +506,13 @@ static gboolean handle_event_cb(GIOChannel *gio, GIOCondition condition, gpointe
}
else
{
- g_cw->Debug(std::string("DebugDumps size has exceeded the limit, deleting the last dump: ") + name);
+ log("DebugDumps size has exceeded the limit, deleting the last dump: %s", name);
DeleteDebugDumpDir(std::string(DEBUG_DUMPS_DIR) + "/" + name);
}
}
else
{
- g_cw->Debug("Some file created, ignoring...");
+ log("Some file created, ignoring...");
}
}
delete[] buf;
@@ -562,6 +562,7 @@ int main(int argc, char** argv)
close(STDERR_FILENO);
xdup(0);
xdup(0);
+ logmode = LOGMODE_SYSLOG;
}
GIOChannel* pGio = NULL;
@@ -645,7 +646,7 @@ int main(int argc, char** argv)
/* Enter the event loop */
try
{
- watcher.Debug("Running...");
+ log("Running...");
g_main_run(g_pMainloop);
}
catch (CABRTException& e)
diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp
index f04b546e..57f5892a 100644
--- a/src/Daemon/MiddleWare.cpp
+++ b/src/Daemon/MiddleWare.cpp
@@ -305,10 +305,8 @@ report_status_t Report(const map_crash_report_t& pCrashReport,
if (s_mapAnalyzerActionsAndReporters.find(analyzer) != s_mapAnalyzerActionsAndReporters.end())
{
- vector_pair_string_string_t::iterator it_r;
- for (it_r = s_mapAnalyzerActionsAndReporters[analyzer].begin();
- it_r != s_mapAnalyzerActionsAndReporters[analyzer].end();
- it_r++)
+ vector_pair_string_string_t::iterator it_r = s_mapAnalyzerActionsAndReporters[analyzer].begin();
+ for (; it_r != s_mapAnalyzerActionsAndReporters[analyzer].end(); it_r++)
{
try
{
@@ -333,7 +331,7 @@ report_status_t Report(const map_crash_report_t& pCrashReport,
{
oldSettings = reporter->GetSettings();
- if (LoadPluginSettings(home + "/.abrt/" + (*it_r).first + "." + PLUGINS_CONF_EXTENSION, newSettings))
+ if (LoadPluginSettings(home + "/.abrt/" + (*it_r).first + "."PLUGINS_CONF_EXTENSION, newSettings))
{
reporter->SetSettings(newSettings);
}
@@ -448,22 +446,22 @@ static mw_result_t SavePackageDescriptionToDebugDump(const std::string& pExecuta
{
if (packageName == "")
{
- comm_layer_inner_debug("Executable doesn't belong to any package");
+ error_msg("Executable doesn't belong to any package");
return MW_PACKAGE_ERROR;
}
- comm_layer_inner_debug("Blacklisted package");
+ log("Blacklisted package");
return MW_BLACKLISTED;
}
if (g_settings_bOpenGPGCheck)
{
if (!s_RPM.CheckFingerprint(packageName))
{
- comm_layer_inner_debug("package isn't signed with proper key");
+ error_msg("package isn't signed with proper key");
return MW_GPG_ERROR;
}
if (!s_RPM.CheckHash(packageName, pExecutable))
{
- comm_layer_inner_debug("executable has bad hash");
+ error_msg("executable has bad hash");
return MW_GPG_ERROR;
}
}
@@ -555,12 +553,12 @@ static mw_result_t SaveDebugDumpToDatabase(const std::string& pUUID,
res = GetCrashInfo(pUUID, pUID, pCrashInfo);
if (row.m_sReported == "1")
{
- comm_layer_inner_debug("Crash is already reported");
+ log("Crash is already reported");
return MW_REPORTED;
}
if (row.m_sCount != "1")
{
- comm_layer_inner_debug("Crash is in database already");
+ log("Crash is in database already");
return MW_OCCURED;
}
return res;
diff --git a/src/Daemon/MiddleWare.h b/src/Daemon/MiddleWare.h
index 73a793ef..97d08cb4 100644
--- a/src/Daemon/MiddleWare.h
+++ b/src/Daemon/MiddleWare.h
@@ -96,7 +96,7 @@ void RunActionsAndReporters(const std::string& pDebugDumpDir);
* ...).
* @param pCrashReport A crash report.
* @param pUID An user uid
- * @return A report status, which reporters ends sucessfuly with messages.
+ * @return A report status, which reporters ends successfuly with messages.
*/
report_status_t Report(const map_crash_report_t& pCrashReport,
const std::string& pUID);
diff --git a/src/Daemon/PluginManager.cpp b/src/Daemon/PluginManager.cpp
index 24fa4961..2d81c47e 100644
--- a/src/Daemon/PluginManager.cpp
+++ b/src/Daemon/PluginManager.cpp
@@ -19,16 +19,12 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <fstream>
#include <iostream>
-#include "PluginManager.h"
+#include "abrtlib.h"
#include "ABRTException.h"
#include "CommLayerInner.h"
-#include <dirent.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include "abrtlib.h"
-#include <fstream>
+#include "PluginManager.h"
/**
* Text representation of plugin types.
@@ -178,7 +174,7 @@ void CPluginManager::LoadPlugin(const std::string& pName)
{
throw CABRTException(EXCEP_PLUGIN, "CPluginManager::LoadPlugin(): non-compatible plugin");
}
- comm_layer_inner_debug("Plugin " + pName + " (" + abrtPlugin->GetVersion() + ") succesfully loaded.");
+ log("Plugin %s (%s) succesfully loaded", pName.c_str(), abrtPlugin->GetVersion());
m_mapABRTPlugins[pName] = abrtPlugin;
}
catch (CABRTException& e)
@@ -200,7 +196,7 @@ void CPluginManager::UnLoadPlugin(const std::string& pName)
UnRegisterPlugin(pName);
delete m_mapABRTPlugins[pName];
m_mapABRTPlugins.erase(pName);
- comm_layer_inner_debug("Plugin " + pName + " sucessfully unloaded.");
+ log("Plugin %s successfully unloaded", pName.c_str());
}
}
@@ -228,9 +224,7 @@ void CPluginManager::RegisterPlugin(const std::string& pName)
return;
}
m_mapPlugins[pName] = plugin;
- comm_layer_inner_debug("Registered plugin " + pName + "("
- + std::string(plugin_type_str[m_mapABRTPlugins[pName]->GetType()])
- + ")");
+ log("Registered plugin %s(%s)", pName.c_str(), plugin_type_str[m_mapABRTPlugins[pName]->GetType()]);
}
}
}
@@ -244,9 +238,7 @@ void CPluginManager::UnRegisterPlugin(const std::string& pName)
m_mapPlugins[pName]->DeInit();
delete m_mapPlugins[pName];
m_mapPlugins.erase(pName);
- comm_layer_inner_debug("UnRegistred plugin " + pName + "("
- + std::string(plugin_type_str[m_mapABRTPlugins[pName]->GetType()])
- + ")");
+ log("UnRegistered plugin %s(%s)", pName.c_str(), plugin_type_str[m_mapABRTPlugins[pName]->GetType()]);
}
}
}