]> granicus.if.org Git - python/commitdiff
Bug #1737864: allow empty message in logging format routines.
authorGeorg Brandl <georg@python.org>
Tue, 19 Jun 2007 12:36:00 +0000 (12:36 +0000)
committerGeorg Brandl <georg@python.org>
Tue, 19 Jun 2007 12:36:00 +0000 (12:36 +0000)
Lib/logging/__init__.py

index 321e118c339fdb9593c45982b744241c8865d7bf..d667b73fc33f6e60b82f7462339b7f0df9fdb717 100644 (file)
@@ -398,7 +398,7 @@ class Formatter:
         traceback.print_exception(ei[0], ei[1], ei[2], None, sio)
         s = sio.getvalue()
         sio.close()
-        if s[-1] == "\n":
+        if s[-1:] == "\n":
             s = s[:-1]
         return s
 
@@ -425,7 +425,7 @@ class Formatter:
             if not record.exc_text:
                 record.exc_text = self.formatException(record.exc_info)
         if record.exc_text:
-            if s[-1] != "\n":
+            if s[-1:] != "\n":
                 s = s + "\n"
             s = s + record.exc_text
         return s