diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-08-25 18:25:16 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-08-25 18:25:16 +0200 |
commit | dc8ad3b59e41ffce53541411649b6838e905b8b5 (patch) | |
tree | f3d4aa18dc4777f0028baf75e0ec44cdca366bac /lib | |
parent | 58e6c582c3103dac17f5575c6bd17ee7c0784f05 (diff) | |
download | abrt-dc8ad3b59e41ffce53541411649b6838e905b8b5.tar.gz abrt-dc8ad3b59e41ffce53541411649b6838e905b8b5.tar.xz abrt-dc8ad3b59e41ffce53541411649b6838e905b8b5.zip |
more sensible logging
comm_layer_inner_debug was jumping through the hoops
in order to simply send a message to stderr.
this can be made much simpler.
also, set logmode to LOGMODE_SYSLOG in abrt daemon,
making its log visible if it is daemonized.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Plugins/Bugzilla.cpp | 16 | ||||
-rw-r--r-- | lib/Plugins/CCpp.cpp | 2 | ||||
-rw-r--r-- | lib/Plugins/FileTransfer.cpp | 10 | ||||
-rw-r--r-- | lib/Plugins/KerneloopsScanner.cpp | 14 |
4 files changed, 18 insertions, 24 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; |