aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2014-06-27 19:51:11 +0100
committerBryn M. Reeves <bmr@redhat.com>2014-06-30 19:48:43 +0100
commite1661f4722d54f9ba7eda006055492201cdc196c (patch)
tree98df5672a6206af6519f2a6823d3066504ac60d9
parent80bbce0ba4f268489da9b6e7dcaa03f0da4c3102 (diff)
downloadsos-e1661f4722d54f9ba7eda006055492201cdc196c.tar.gz
[plugin] only print a summary of strings added to the archive
When we're using add_string_as_file() to add tailed file contents to the archive the string may contain many thousands of lines. Only print a summary snippet showing the last line to avoid spamming entire log files to the terminal in -vv mode. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/__init__.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 7758fa99..f78f1e21 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -517,6 +517,7 @@ class Plugin(object):
def add_string_as_file(self, content, filename):
"""Add a string to the archive as a file named `filename`"""
self.copy_strings.append((content, filename))
+ content = "..." + content.splitlines()[0]
self.log_debug("added string '%s' as '%s'" % (content,filename))
def get_cmd_output_now(self, exe, suggest_filename=None,
@@ -584,7 +585,7 @@ class Plugin(object):
def collect_strings(self):
for string, file_name in self.copy_strings:
self.log_info("collecting string '%s' as '%s'"
- % (string, file_name))
+ % ("..." + string.splitlines()[0], file_name))
try:
self.archive.add_string(string,
os.path.join('sos_strings', self.name(), file_name))