diff options
author | Sol Jerome <sol.jerome@gmail.com> | 2011-05-09 15:20:11 -0500 |
---|---|---|
committer | Sol Jerome <sol.jerome@gmail.com> | 2011-06-14 12:36:45 -0500 |
commit | ffce8cbd14a0ddc2cd266d80d63b36a786c08cb0 (patch) | |
tree | 6e65068ef2d899f7211ba8e137c3cb0c6a2590fe /src | |
parent | 382d96a8146a888c6edca7a20ee6cb348b202c4b (diff) | |
download | bcfg2-ffce8cbd14a0ddc2cd266d80d63b36a786c08cb0.tar.gz bcfg2-ffce8cbd14a0ddc2cd266d80d63b36a786c08cb0.tar.bz2 bcfg2-ffce8cbd14a0ddc2cd266d80d63b36a786c08cb0.zip |
Logger: Statement always was True in python 2
Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Logger.py | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/lib/Logger.py b/src/lib/Logger.py index 0a72e038c..8920ba747 100644 --- a/src/lib/Logger.py +++ b/src/lib/Logger.py @@ -12,8 +12,6 @@ import sys import termios # Compatibility import from Bcfg2.Bcfg2Py3k import fprint -if sys.hexversion >= 0x03000000: - str = bytes logging.raiseExceptions = 0 @@ -120,19 +118,16 @@ class FragmentingSysLogHandler(logging.handlers.SysLogHandler): def emit(self, record): """Chunk and deliver records.""" record.name = self.procname - if str(record.msg) > 250: - msgs = [] - error = record.exc_info - record.exc_info = None - msgdata = record.msg - while msgdata: - newrec = copy.deepcopy(record) - newrec.msg = msgdata[:250] - msgs.append(newrec) - msgdata = msgdata[250:] - msgs[0].exc_info = error - else: - msgs = [record] + msgs = [] + error = record.exc_info + record.exc_info = None + msgdata = record.msg + while msgdata: + newrec = copy.deepcopy(record) + newrec.msg = msgdata[:250] + msgs.append(newrec) + msgdata = msgdata[250:] + msgs[0].exc_info = error for newrec in msgs: msg = self.log_format_string % (self.encodePriority(self.facility, newrec.levelname.lower()), |