diff options
author | Sol Jerome <sol.jerome@gmail.com> | 2012-08-14 18:59:31 -0500 |
---|---|---|
committer | Sol Jerome <sol.jerome@gmail.com> | 2012-08-14 19:00:05 -0500 |
commit | bee3e2f0ab40e5aab8a01edfc6f5619ffacdb092 (patch) | |
tree | 1cdc2ce76a868ca9c592c4440bc3e9f119cdf43c /src/lib | |
parent | b5524d7f6a0ea5b01f058b67c17e5e07939af662 (diff) | |
download | bcfg2-bee3e2f0ab40e5aab8a01edfc6f5619ffacdb092.tar.gz bcfg2-bee3e2f0ab40e5aab8a01edfc6f5619ffacdb092.tar.bz2 bcfg2-bee3e2f0ab40e5aab8a01edfc6f5619ffacdb092.zip |
Logger: Fix traceback
Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Bcfg2/Logger.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/Bcfg2/Logger.py b/src/lib/Bcfg2/Logger.py index 81b45550f..903209ac3 100644 --- a/src/lib/Bcfg2/Logger.py +++ b/src/lib/Bcfg2/Logger.py @@ -57,9 +57,11 @@ class TermiosFormatter(logging.Formatter): lines = int(math.ceil(float(len(record.msg)) / columns)) for lineNumber in range(lines): indices = [idx for idx in [(colNum * lines) + lineNumber - for colNum in range(columns)] if idx < len(record.msg)] - format = (len(indices) * (" %%-%ds " % columnWidth)) - returns.append(format % tuple([record.msg[idx] for idx in indices])) + for colNum in range(columns)] + if idx < len(record.msg)] + retformat = (len(indices) * (" %%-%ds " % columnWidth)) + returns.append(retformat % tuple([record.msg[idx] + for idx in indices])) else: returns.append(str(record.msg)) if record.exc_info: @@ -86,6 +88,8 @@ class FragmentingSysLogHandler(logging.handlers.SysLogHandler): error = record.exc_info record.exc_info = None msgdata = record.msg + if len(msgdata) == 0: + return while msgdata: newrec = copy.copy(record) newrec.msg = msgdata[:250] |