SwiftGUI_Logging 0.1.1__tar.gz → 0.1.2__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.1
3
+ Version: 0.1.2
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
@@ -79,11 +79,33 @@ if __name__ == '__main__':
79
79
 
80
80
  You'll find that the directory `Crashlogs` was created.
81
81
  After the program executes, the directory contains a file like
82
- `Crash_2026-02-24_16-16-38.log`.
82
+ `Crash_2026-02-24_16-33-52.log`.
83
83
 
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`)
88
+ and the exception with full traceback:
89
+ ```log
90
+ 2026-02-24 16:33:49,940 - root - DEBUG - Test 0
91
+ 2026-02-24 16:33:50,197 - root - DEBUG - Test 1
92
+ 2026-02-24 16:33:50,451 - root - DEBUG - Test 2
93
+ 2026-02-24 16:33:50,704 - root - DEBUG - Test 3
94
+ 2026-02-24 16:33:50,958 - root - DEBUG - Test 4
95
+ 2026-02-24 16:33:51,214 - root - DEBUG - Test 5
96
+ 2026-02-24 16:33:51,469 - root - DEBUG - Test 6
97
+ 2026-02-24 16:33:51,723 - root - DEBUG - Test 7
98
+ 2026-02-24 16:33:51,979 - root - DEBUG - Test 8
99
+ 2026-02-24 16:33:52,235 - root - DEBUG - Test 9
100
+ 2026-02-24 16:33:52,490 - root - INFO - Crashing the program now
101
+ 2026-02-24 16:33:52,490 - root - ERROR - Traceback (most recent call last):
102
+ File "C:\Users\chees\PycharmProjects\SwiftGUI-Logging\tests\test.py", line 17, in <module>
103
+ main() # Execute program
104
+ File "C:\Users\chees\PycharmProjects\SwiftGUI-Logging\tests\test.py", line 13, in main
105
+ 1 / 0 # Cause a ZeroDivisionError, which crashes the program
106
+ ZeroDivisionError: division by zero
107
+ ```
108
+
87
109
  `sgl.Configs.exceptions_to_file` can do a bit more, but for most programs,
88
110
  the default configuration is fine.
89
111
 
@@ -63,11 +63,33 @@ if __name__ == '__main__':
63
63
 
64
64
  You'll find that the directory `Crashlogs` was created.
65
65
  After the program executes, the directory contains a file like
66
- `Crash_2026-02-24_16-16-38.log`.
66
+ `Crash_2026-02-24_16-33-52.log`.
67
67
 
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`)
72
+ and the exception with full traceback:
73
+ ```log
74
+ 2026-02-24 16:33:49,940 - root - DEBUG - Test 0
75
+ 2026-02-24 16:33:50,197 - root - DEBUG - Test 1
76
+ 2026-02-24 16:33:50,451 - root - DEBUG - Test 2
77
+ 2026-02-24 16:33:50,704 - root - DEBUG - Test 3
78
+ 2026-02-24 16:33:50,958 - root - DEBUG - Test 4
79
+ 2026-02-24 16:33:51,214 - root - DEBUG - Test 5
80
+ 2026-02-24 16:33:51,469 - root - DEBUG - Test 6
81
+ 2026-02-24 16:33:51,723 - root - DEBUG - Test 7
82
+ 2026-02-24 16:33:51,979 - root - DEBUG - Test 8
83
+ 2026-02-24 16:33:52,235 - root - DEBUG - Test 9
84
+ 2026-02-24 16:33:52,490 - root - INFO - Crashing the program now
85
+ 2026-02-24 16:33:52,490 - root - ERROR - Traceback (most recent call last):
86
+ File "C:\Users\chees\PycharmProjects\SwiftGUI-Logging\tests\test.py", line 17, in <module>
87
+ main() # Execute program
88
+ File "C:\Users\chees\PycharmProjects\SwiftGUI-Logging\tests\test.py", line 13, in main
89
+ 1 / 0 # Cause a ZeroDivisionError, which crashes the program
90
+ ZeroDivisionError: division by zero
91
+ ```
92
+
71
93
  `sgl.Configs.exceptions_to_file` can do a bit more, but for most programs,
72
94
  the default configuration is fine.
73
95
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "SwiftGUI_Logging"
3
- version = "0.1.1"
3
+ version = "0.1.2"
4
4
  packages = [
5
5
  { include = "SwiftGUI_Logging", from = "src" }
6
6
  ]
@@ -59,7 +59,7 @@ def exceptions_to_file(
59
59
  # Add current datetime to filename
60
60
  actual_filepath = filepath.parent / (filepath.stem + dt.now().strftime(datetime_format) + filepath.suffix)
61
61
 
62
- with open(actual_filepath, "w") as f:
62
+ with open(actual_filepath, "a") as f:
63
63
  stream.seek(0)
64
64
  shutil.copyfileobj(stream, f)
65
65