From 056a24205300a8d7c410b7537c6c31bbf979d8d1 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Tue, 21 Feb 2006 22:52:51 +0000 Subject: Fix output logging git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1761 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Logging.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/lib/Logging.py') diff --git a/src/lib/Logging.py b/src/lib/Logging.py index 70270ff23..afaed1c96 100644 --- a/src/lib/Logging.py +++ b/src/lib/Logging.py @@ -46,7 +46,7 @@ class TermiosFormatter(logging.Formatter): self.width = 80 else: # output to a pipe - self.width = sys.maxint + self.width = 32768 def format(self, record): '''format a record for display''' @@ -59,22 +59,21 @@ class TermiosFormatter(logging.Formatter): else: inner_lines = int(math.floor(float(len(line)) / line_len))+1 for i in xrange(inner_lines): - returns.append("%s: %s" % (record.name, line[i*line_len:(i+1)*line_len])) + returns.append("%s" % (line[i*line_len:(i+1)*line_len])) elif type(record.msg) == types.ListType: record.msg.sort() - msgwidth = self.width - len(record.name) - 2 + msgwidth = self.width columnWidth = max([len(item) for item in record.msg]) columns = int(math.floor(float(msgwidth) / (columnWidth+2))) lines = int(math.ceil(float(len(record.msg)) / columns)) for lineNumber in xrange(lines): indices = [idx for idx in [(colNum * lines) + lineNumber for colNum in range(columns)] if idx < len(record.msg)] - format = record.name + ':' + (len(indices) * (" %%-%ds " % columnWidth)) + format = (len(indices) * (" %%-%ds " % columnWidth)) returns.append(format % tuple([record.msg[idx] for idx in indices])) elif type(record.msg) == lxml.etree._Element: returns.append(str(xml_print(record.msg))) else: - returns.append("Got unsupported type %s" % (str(type(record.msg)))) returns.append(record.name + ':' + str(record.msg)) if record.exc_info: returns.append(self.formatException(record.exc_info)) -- cgit v1.2.3-1-g7c22