summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSol Jerome <sol.jerome@gmail.com>2011-05-10 08:55:53 -0500
committerSol Jerome <sol.jerome@gmail.com>2011-06-14 12:36:45 -0500
commite6383bdb7d19729d340565fb091a8b67831a5835 (patch)
tree38f0e698a1fd3cbeda2ff9c289800e8c59344876
parentffce8cbd14a0ddc2cd266d80d63b36a786c08cb0 (diff)
downloadbcfg2-e6383bdb7d19729d340565fb091a8b67831a5835.tar.gz
bcfg2-e6383bdb7d19729d340565fb091a8b67831a5835.tar.bz2
bcfg2-e6383bdb7d19729d340565fb091a8b67831a5835.zip
Logger: Fix non-string logging
Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
-rw-r--r--src/lib/Logger.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/lib/Logger.py b/src/lib/Logger.py
index 8920ba747..9fe81f47e 100644
--- a/src/lib/Logger.py
+++ b/src/lib/Logger.py
@@ -118,16 +118,19 @@ class FragmentingSysLogHandler(logging.handlers.SysLogHandler):
def emit(self, record):
"""Chunk and deliver records."""
record.name = self.procname
- 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
+ if isinstance(record.msg, str):
+ 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]
for newrec in msgs:
msg = self.log_format_string % (self.encodePriority(self.facility,
newrec.levelname.lower()),