SwiftGUI_Logging 0.1.2__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SwiftGUI_Logging
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: A collection of helpful logging-functionality based on the logging package
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE
@@ -84,7 +84,7 @@ After the program executes, the directory contains a file like
84
84
  As you can see, the time of the crash was inserted into the
85
85
  filename, so that multiple crashlogs don't overwrite each other.
86
86
 
87
- The file contains the most recent log-entries (from `logging.debug`)
87
+ The file contains the most recent log-entries (from `logging.debug` and `logging.info`)
88
88
  and the exception with full traceback:
89
89
  ```log
90
90
  2026-02-24 16:33:49,940 - root - DEBUG - Test 0
@@ -68,7 +68,7 @@ After the program executes, the directory contains a file like
68
68
  As you can see, the time of the crash was inserted into the
69
69
  filename, so that multiple crashlogs don't overwrite each other.
70
70
 
71
- The file contains the most recent log-entries (from `logging.debug`)
71
+ The file contains the most recent log-entries (from `logging.debug` and `logging.info`)
72
72
  and the exception with full traceback:
73
73
  ```log
74
74
  2026-02-24 16:33:49,940 - root - DEBUG - Test 0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "SwiftGUI_Logging"
3
- version = "0.1.2"
3
+ version = "0.1.3"
4
4
  packages = [
5
5
  { include = "SwiftGUI_Logging", from = "src" }
6
6
  ]
@@ -20,6 +20,7 @@ class MemoryHandlerRotatingBuffer(logging.handlers.MemoryHandler):
20
20
  """
21
21
  super().__init__(capacity, flushLevel, target, flushOnClose=False)
22
22
  self.call_after_flushing = call_after_flushing if call_after_flushing else lambda *_:_
23
+ self._should_flush = False
23
24
 
24
25
  def shouldFlush(self, record):
25
26
  """
@@ -30,10 +31,17 @@ class MemoryHandlerRotatingBuffer(logging.handlers.MemoryHandler):
30
31
  if len(self.buffer) > self.capacity: # Remove 0th element so the buffer doesn't "overflow"
31
32
  self.buffer.pop(0)
32
33
 
33
- return record.levelno >= self.flushLevel
34
+ if record.levelno >= self.flushLevel:
35
+ self._should_flush = True
36
+ return True
37
+
38
+ return False
34
39
 
35
40
  def flush(self):
36
- super().flush()
37
- self.call_after_flushing()
41
+ super().flush() # Don't put this in the if, this is necessary due to Python-magic...
42
+
43
+ if self._should_flush:
44
+ self.call_after_flushing()
45
+ self._should_flush = False
38
46
 
39
47