diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2006-02-21 22:52:51 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2006-02-21 22:52:51 +0000 |
commit | 056a24205300a8d7c410b7537c6c31bbf979d8d1 (patch) | |
tree | 631a2e2a845206eb63f09d5606ec0ed0a6cffefb /src/lib/Logging.py | |
parent | ed7df56e513ad4b3173de0ead803a4654510aff9 (diff) | |
download | bcfg2-056a24205300a8d7c410b7537c6c31bbf979d8d1.tar.gz bcfg2-056a24205300a8d7c410b7537c6c31bbf979d8d1.tar.bz2 bcfg2-056a24205300a8d7c410b7537c6c31bbf979d8d1.zip |
Fix output logging
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1761 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Logging.py')
-rw-r--r-- | src/lib/Logging.py | 9 |
1 files changed, 4 insertions, 5 deletions
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)) |