Browse Source

directnotify: Fix RotatingLog filePath error when sizeLimit is None

rdb 2 năm trước cách đây
mục cha
commit
c63a92bdec
1 tập tin đã thay đổi với 4 bổ sung3 xóa
  1. 4 3
      direct/src/directnotify/RotatingLog.py

+ 4 - 3
direct/src/directnotify/RotatingLog.py

@@ -55,10 +55,11 @@ class RotatingLog:
         return 0
 
     def filePath(self):
-        dateString=time.strftime("%Y_%m_%d_%H", time.localtime())
+        dateString = time.strftime("%Y_%m_%d_%H", time.localtime())
         for i in range(26):
-            path="%s_%s_%s.log"%(self.path, dateString, chr(i+97))
-            if not os.path.exists(path) or os.stat(path)[6] < self.sizeLimit:
+            limit = self.sizeLimit
+            path = "%s_%s_%s.log" % (self.path, dateString, chr(i+97))
+            if limit is None not os.path.exists(path) or os.stat(path)[6] < limit:
                 return path
         # Hmm, 26 files are full?  throw the rest in z:
         # Maybe we should clear the self.sizeLimit here... maybe.