Revision: 355
Author: allenb
Date: 2006-07-27 12:04:38 -0700 (Thu, 27 Jul 2006)
ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=355&view=rev
Log Message:
-----------
- When using a Linux console, auto detect the width using curses.
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/_logging_/multi_line_formatter.py
Modified: pyplusplus_dev/pyplusplus/_logging_/multi_line_formatter.py
===================================================================
--- pyplusplus_dev/pyplusplus/_logging_/multi_line_formatter.py 2006-07-27 18:47:29 UTC (rev 354)
+++ pyplusplus_dev/pyplusplus/_logging_/multi_line_formatter.py 2006-07-27 19:04:38 UTC (rev 355)
@@ -14,7 +14,7 @@
its messages to stdout.
"""
- def __init__(self, fmt=None, datefmt=None, width=70):
+ def __init__(self, fmt=None, datefmt=None, width=None):
"""Constructor.
See the Python standard library reference for a documentation
@@ -22,7 +22,13 @@
width is the maximum width of the generated text blocks.
"""
logging.Formatter.__init__(self, fmt, datefmt)
- self._width = width
+ if None == width:
+ try:
+ import curses
+ curses.setupterm()
+ self._width = curses.tigetnum('cols')
+ except:
+ self._width = 70 # default to 70
def format(self, record):
"""This method overwrites the original one.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|