summaryrefslogtreecommitdiffstats
path: root/lib/Utils/make_descr.cpp
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-10-30 19:17:10 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-10-30 19:17:10 +0100
commit276a9017d63445dd322f9a93ff34e67cbdf97dc9 (patch)
treebe5d38eaa1aeaefe49966ea280e6e8d13e6ec2ce /lib/Utils/make_descr.cpp
parentb4e0ad1ef24fd49bcd5cdd1b6f1dd69768036e07 (diff)
downloadabrt-276a9017d63445dd322f9a93ff34e67cbdf97dc9.tar.gz
abrt-276a9017d63445dd322f9a93ff34e67cbdf97dc9.tar.xz
abrt-276a9017d63445dd322f9a93ff34e67cbdf97dc9.zip
lib/Plugins/Logger: much more sane dump format; fix misdetection of text files
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib/Utils/make_descr.cpp')
-rw-r--r--lib/Utils/make_descr.cpp81
1 files changed, 27 insertions, 54 deletions
diff --git a/lib/Utils/make_descr.cpp b/lib/Utils/make_descr.cpp
index 2823dbb4..71b91912 100644
--- a/lib/Utils/make_descr.cpp
+++ b/lib/Utils/make_descr.cpp
@@ -11,14 +11,13 @@ static void add_content(bool &was_multiline, string& description, const char *he
if (was_multiline)
description += '\n';
- description += header;
-
while (content[0] == '\n')
content++;
if (strchr(content, '\n') == NULL)
{
/* one string value, like OS release */
+ description += header;
description += ": ";
description += content;
description += '\n';
@@ -27,6 +26,9 @@ static void add_content(bool &was_multiline, string& description, const char *he
else
{
/* multi-string value, like backtrace */
+ if (!was_multiline && description.size() != 0) /* if wasn't yet separated */
+ description += '\n'; /* do it now */
+ description += header;
description += "\n-----\n";
description += content;
if (content[strlen(content) - 1] != '\n')
@@ -76,11 +78,6 @@ string make_description_bz(const map_crash_report_t& pCrashReport)
{
add_content(was_multiline, description, "Attached file", filename.c_str());
}
- //else if (type == CD_BIN)
- //{
- // string msg = ssprintf(_("Binary file %s is not reported"), filename.c_str());
- // warn_client(msg);
- //}
}
return description;
@@ -88,65 +85,41 @@ string make_description_bz(const map_crash_report_t& pCrashReport)
string make_description_logger(const map_crash_report_t& pCrashReport)
{
-// string description;
- stringstream binaryFiles, commonFiles, bigTextFiles, additionalFiles, UUIDFile;
+ string description;
+ string long_description;
map_crash_report_t::const_iterator it = pCrashReport.begin();
for (; it != pCrashReport.end(); it++)
{
- if (it->second[CD_TYPE] == CD_TXT)
- {
- if (it->first != CD_UUID
- && it->first != FILENAME_ARCHITECTURE
- && it->first != FILENAME_KERNEL
- && it->first != FILENAME_PACKAGE
- ) {
- additionalFiles << it->first << std::endl;
- additionalFiles << "-----" << std::endl;
- additionalFiles << it->second[CD_CONTENT] << std::endl << std::endl;
- }
- else if (it->first == CD_UUID)
+ const string &filename = it->first;
+ const string &type = it->second[CD_TYPE];
+ const string &content = it->second[CD_CONTENT];
+ if (type == CD_TXT
+ || type == CD_ATT
+ || type == CD_BIN
+ ) {
+ bool was_multiline = 0;
+ string tmp;
+ add_content(was_multiline, tmp, filename.c_str(), content.c_str());
+
+ if (was_multiline)
{
- UUIDFile << it->first << std::endl;
- UUIDFile << "-----" << std::endl;
- UUIDFile << it->second[CD_CONTENT] << std::endl << std::endl;
+ if (long_description.size() != 0)
+ long_description += '\n';
+ long_description += tmp;
}
else
{
- commonFiles << it->first << std::endl;
- commonFiles << "-----" << std::endl;
- commonFiles << it->second[CD_CONTENT] << std::endl << std::endl;
+ description += tmp;
}
}
- if (it->second[CD_TYPE] == CD_ATT)
- {
- bigTextFiles << it->first << std::endl;
- bigTextFiles << "-----" << std::endl;
- bigTextFiles << it->second[CD_CONTENT] << std::endl << std::endl;
- }
- if (it->second[CD_TYPE] == CD_BIN)
- {
- binaryFiles << it->first << std::endl;
- binaryFiles << "-----" << std::endl;
- binaryFiles << it->second[CD_CONTENT] << std::endl << std::endl;
- }
}
- string description = "Duplicity check\n======\n\n";
- description += UUIDFile.str();
- description += '\n';
- description += "Common information\n======\n\n";
- description += commonFiles.str();
- description += '\n';
- description += "Additional information\n======\n\n";
- description += additionalFiles.str();
- description += '\n';
- description += "Big Text Files\n======\n\n";
- description += bigTextFiles.str();
- description += '\n';
- description += "Binary files\n======\n";
- description += binaryFiles.str();
- description += "\n\n";
+ if (long_description.size() != 0)
+ {
+ description += '\n';
+ description += long_description;
+ }
return description;
}