diff options
Diffstat (limited to 'lib/Plugins')
-rw-r--r-- | lib/Plugins/CCpp.cpp | 2 | ||||
-rw-r--r-- | lib/Plugins/Logger.cpp | 105 | ||||
-rw-r--r-- | lib/Plugins/Logger.h | 2 | ||||
-rw-r--r-- | lib/Plugins/Mailx.cpp | 112 | ||||
-rw-r--r-- | lib/Plugins/Mailx.h | 2 | ||||
-rw-r--r-- | lib/Plugins/RunApp.h | 2 |
6 files changed, 111 insertions, 114 deletions
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp index 2eb1cead..e0f37144 100644 --- a/lib/Plugins/CCpp.cpp +++ b/lib/Plugins/CCpp.cpp @@ -35,7 +35,7 @@ #include <string.h> #define CORE_PATTERN_IFACE "/proc/sys/kernel/core_pattern" -#define CORE_PATTERN "|"CCPP_HOOK_PATH" %p %s" +#define CORE_PATTERN "|"CCPP_HOOK_PATH" %p %s %u" CAnalyzerCCpp::CAnalyzerCCpp() : m_bMemoryMap(false) diff --git a/lib/Plugins/Logger.cpp b/lib/Plugins/Logger.cpp index e7579372..3b48d5e8 100644 --- a/lib/Plugins/Logger.cpp +++ b/lib/Plugins/Logger.cpp @@ -22,6 +22,8 @@ #include "Logger.h" #include <fstream> #include "Settings.h" +#include <sstream> +#include "DebugDump.h" CLogger::CLogger() : m_sLogPath("/var/log/abrt-logger"), @@ -43,9 +45,47 @@ void CLogger::LoadSettings(const std::string& pPath) } } -void CLogger::Report(const crash_report_t& pReport) +void CLogger::Report(const crash_report_t& pCrashReport) { + std::stringstream binaryFiles, commonFiles, additionalFiles, UUIDFile; std::ofstream fOut; + + crash_report_t::const_iterator it; + for (it = pCrashReport.begin(); it != pCrashReport.end(); it++) + { + if (it->second.m_sType == TYPE_TXT) + { + if (it->first != FILENAME_UUID && + it->first != FILENAME_ARCHITECTURE && + it->first != FILENAME_KERNEL && + it->first != FILENAME_PACKAGE) + { + additionalFiles << it->first << std::endl; + additionalFiles << "-----" << std::endl; + additionalFiles << it->second.m_sContent << std::endl << std::endl; + } + else if (it->first == FILENAME_UUID) + { + UUIDFile << it->first << std::endl; + UUIDFile << "-----" << std::endl; + UUIDFile << it->second.m_sContent << std::endl << std::endl; + } + else + { + commonFiles << it->first << std::endl; + commonFiles << "-----" << std::endl; + commonFiles << it->second.m_sContent << std::endl << std::endl; + } + } + if (it->second.m_sType == TYPE_BIN) + { + binaryFiles << it->first << std::endl; + binaryFiles << "-----" << std::endl; + binaryFiles << it->second.m_sContent << std::endl << std::endl; + } + } + + if (m_bAppendLogs) { fOut.open(m_sLogPath.c_str(), std::ios::app); @@ -56,60 +96,19 @@ void CLogger::Report(const crash_report_t& pReport) } if (fOut.is_open()) { + fOut << "Duplicity check" << std::endl; - fOut << "==================" << std::endl << std::endl; - fOut << "UUID" << std::endl; - fOut << "------------" << std::endl; - fOut << pReport.m_sUUID << std::endl << std::endl; + fOut << "======" << std::endl << std::endl; + fOut << UUIDFile.str() << std::endl; fOut << "Common information" << std::endl; - fOut << "==================" << std::endl << std::endl; - fOut << "Architecture" << std::endl; - fOut << "------------" << std::endl; - fOut << pReport.m_sArchitecture << std::endl << std::endl; - fOut << "Kernel version" << std::endl; - fOut << "--------------" << std::endl; - fOut << pReport.m_sKernel << std::endl << std::endl; - fOut << "Package" << std::endl; - fOut << "-------" << std::endl; - fOut << pReport.m_sPackage << std::endl << std::endl; - fOut << "Executable" << std::endl; - fOut << "----------" << std::endl; - fOut << pReport.m_sExecutable << std::endl << std::endl; - fOut << "CmdLine" << std::endl; - fOut << "----------" << std::endl; - fOut << pReport.m_sCmdLine << std::endl << std::endl; - fOut << "Created report" << std::endl; - fOut << "==============" << std::endl; - fOut << "Text reports" << std::endl; - fOut << "==============" << std::endl; - if (pReport.m_sTextData1 != "") - { - fOut << "Text Data 1" << std::endl; - fOut << "-----------" << std::endl; - fOut << pReport.m_sTextData1 << std::endl << std::endl; - } - if (pReport.m_sTextData2 != "") - { - fOut << "Text Data 2" << std::endl; - fOut << "-----------" << std::endl; - fOut << pReport.m_sTextData2 << std::endl << std::endl; - } - if (pReport.m_sComment != "") - { - fOut << "User Comments" << std::endl; - fOut << "-----------" << std::endl; - fOut << pReport.m_sComment << std::endl << std::endl; - } - fOut << "Binary reports" << std::endl; - fOut << "==============" << std::endl; - if (pReport.m_sBinaryData1 != "") - { - fOut << "1. " << pReport.m_sBinaryData1 << std::endl; - } - if (pReport.m_sBinaryData2 != "") - { - fOut << "2. " << pReport.m_sBinaryData2 << std::endl; - } + fOut << "======" << std::endl << std::endl; + fOut << commonFiles.str() << std::endl; + fOut << "Additional information" << std::endl; + fOut << "======" << std::endl << std::endl; + fOut << additionalFiles.str() << std::endl; + fOut << "Binary files" << std::endl; + fOut << "======" << std::endl; + fOut << binaryFiles.str() << std::endl; fOut << std::endl; fOut.close(); } diff --git a/lib/Plugins/Logger.h b/lib/Plugins/Logger.h index f6dcffd8..f465ee05 100644 --- a/lib/Plugins/Logger.h +++ b/lib/Plugins/Logger.h @@ -36,7 +36,7 @@ class CLogger : public CReporter virtual ~CLogger() {} void LoadSettings(const std::string& pPath); - void Report(const crash_report_t& pReport); + void Report(const crash_report_t& pCrashReport); }; diff --git a/lib/Plugins/Mailx.cpp b/lib/Plugins/Mailx.cpp index 1f83cb55..8c0c4a6b 100644 --- a/lib/Plugins/Mailx.cpp +++ b/lib/Plugins/Mailx.cpp @@ -58,71 +58,69 @@ void CMailx::SendEmail(const std::string& pText) } -void CMailx::Report(const crash_report_t& pReport) +void CMailx::Report(const crash_report_t& pCrashReport) { - std::stringstream ss; - - ss << "Duplicity check" << std::endl; - ss << "==================" << std::endl << std::endl; - ss << "UUID" << std::endl; - ss << "------------" << std::endl; - ss << pReport.m_sUUID << std::endl << std::endl; - ss << "Common information" << std::endl; - ss << "==================" << std::endl << std::endl; - ss << "Architecture" << std::endl; - ss << "------------" << std::endl; - ss << pReport.m_sArchitecture << std::endl << std::endl; - ss << "Kernel version" << std::endl; - ss << "--------------" << std::endl; - ss << pReport.m_sKernel << std::endl << std::endl; - ss << "Package" << std::endl; - ss << "-------" << std::endl; - ss << pReport.m_sPackage << std::endl << std::endl; - ss << "Executable" << std::endl; - ss << "----------" << std::endl; - ss << pReport.m_sExecutable << std::endl << std::endl; - ss << "CmdLine" << std::endl; - ss << "----------" << std::endl; - ss << pReport.m_sCmdLine << std::endl << std::endl; - ss << "Created report" << std::endl; - ss << "==============" << std::endl; - ss << "Text reports" << std::endl; - ss << "==============" << std::endl; - if (pReport.m_sTextData1 != "") - { - ss << "Text Data 1" << std::endl; - ss << "-----------" << std::endl; - ss << pReport.m_sTextData1 << std::endl << std::endl; - } - if (pReport.m_sTextData2 != "") - { - ss << "Text Data 2" << std::endl; - ss << "-----------" << std::endl; - ss << pReport.m_sTextData2 << std::endl << std::endl; - } - if (pReport.m_sComment != "") - { - ss << "User Comments" << std::endl; - ss << "-----------" << std::endl; - ss << pReport.m_sComment << std::endl << std::endl; - } - ss << "Binary reports" << std::endl; - ss << "==============" << std::endl; - ss << "See the attachment[s]" << std::endl; + std::stringstream emailBody; + std::stringstream binaryFiles, commonFiles, additionalFiles, UUIDFile; - if (m_bSendBinaryData) + crash_report_t::const_iterator it; + for (it = pCrashReport.begin(); it != pCrashReport.end(); it++) { - if (pReport.m_sBinaryData1 != "") + if (it->second.m_sType == TYPE_TXT) { - m_sAttachments = " -a " + pReport.m_sBinaryData1; + if (it->first != FILENAME_UUID && + it->first != FILENAME_ARCHITECTURE && + it->first != FILENAME_KERNEL && + it->first != FILENAME_PACKAGE) + { + additionalFiles << it->first << std::endl; + additionalFiles << "-----" << std::endl; + additionalFiles << it->second.m_sContent << std::endl; + } + else if (it->first == FILENAME_UUID) + { + UUIDFile << it->first << std::endl; + UUIDFile << "-----" << std::endl; + UUIDFile << it->second.m_sContent << std::endl; + } + else + { + commonFiles << it->first << std::endl; + commonFiles << "-----" << std::endl; + commonFiles << it->second.m_sContent << std::endl; + } } - if (pReport.m_sBinaryData2 != "") + if (it->second.m_sType == TYPE_BIN) { - m_sAttachments = " -a " + pReport.m_sBinaryData2; + binaryFiles << " -a " << it->second.m_sContent; } } - SendEmail(ss.str()); + + + emailBody << "Duplicity check" << std::endl; + emailBody << "=====" << std::endl << std::endl; + emailBody << UUIDFile.str() << std::endl; + emailBody << "Common information" << std::endl; + emailBody << "=====" << std::endl << std::endl; + emailBody << commonFiles.str() << std::endl; + emailBody << "Additional information" << std::endl; + emailBody << "=====" << std::endl << std::endl; + emailBody << additionalFiles.str() << std::endl; + emailBody << "Binary file[s]" << std::endl; + emailBody << "=====" << std::endl; + + if (m_bSendBinaryData) + { + emailBody << "See the attachment[s]" << std::endl; + m_sAttachments = binaryFiles.str(); + } + else + { + emailBody << "Do not send them." << std::endl; + } + + SendEmail(emailBody.str()); } void CMailx::LoadSettings(const std::string& pPath) @@ -144,6 +142,6 @@ void CMailx::LoadSettings(const std::string& pPath) } if (settings.find("SendBinaryData")!= settings.end()) { - m_bSendBinaryData = settings["SendBinaryData"] == "yes"; + m_bSendBinaryData = settings["SendBinaryData"] == "no"; } } diff --git a/lib/Plugins/Mailx.h b/lib/Plugins/Mailx.h index 15072632..0303bb65 100644 --- a/lib/Plugins/Mailx.h +++ b/lib/Plugins/Mailx.h @@ -43,7 +43,7 @@ class CMailx : public CReporter virtual ~CMailx() {} void LoadSettings(const std::string& pPath); - void Report(const crash_report_t& pReport); + void Report(const crash_report_t& pCrashReport); }; diff --git a/lib/Plugins/RunApp.h b/lib/Plugins/RunApp.h index d075cbb8..1ffd00a8 100644 --- a/lib/Plugins/RunApp.h +++ b/lib/Plugins/RunApp.h @@ -35,7 +35,7 @@ class CActionRunApp : public CAction public: virtual ~CActionRunApp() {} virtual void Run(const std::string& pDebugDumpDir, - const std::string& pParams); + const std::string& pArgs); }; PLUGIN_INFO(ACTION, |