D-SafeLogger 0.2.0__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.
Files changed (163) hide show
  1. d_safelogger-0.2.0/BENCHMARK.md +192 -0
  2. d_safelogger-0.2.0/CHANGELOG.md +68 -0
  3. d_safelogger-0.2.0/CONTRIBUTING.md +78 -0
  4. d_safelogger-0.2.0/LICENSE +190 -0
  5. d_safelogger-0.2.0/MANIFEST.in +60 -0
  6. d_safelogger-0.2.0/PKG-INFO +295 -0
  7. d_safelogger-0.2.0/README.md +268 -0
  8. d_safelogger-0.2.0/README_ja.md +268 -0
  9. d_safelogger-0.2.0/SECURITY.md +41 -0
  10. d_safelogger-0.2.0/TESTING.md +204 -0
  11. d_safelogger-0.2.0/benchmarks/_benchmark_report.py +746 -0
  12. d_safelogger-0.2.0/benchmarks/results/benchmark_20260506_180018/summary.json +2653 -0
  13. d_safelogger-0.2.0/benchmarks/results/benchmark_20260506_180018/summary.md +277 -0
  14. d_safelogger-0.2.0/benchmarks/results/benchmarks_multi_integ_20260506_185947/summary.json +16188 -0
  15. d_safelogger-0.2.0/benchmarks/results/benchmarks_multi_integ_20260506_185947/summary.md +173 -0
  16. d_safelogger-0.2.0/benchmarks/results/benchmarks_multi_perf_20260506_190518/summary.json +16188 -0
  17. d_safelogger-0.2.0/benchmarks/results/benchmarks_multi_perf_20260506_190518/summary.md +173 -0
  18. d_safelogger-0.2.0/benchmarks/results/benchmarks_multi_resilience_20260506_211129/summary.json +3051 -0
  19. d_safelogger-0.2.0/benchmarks/results/benchmarks_multi_resilience_20260506_211129/summary.md +85 -0
  20. d_safelogger-0.2.0/benchmarks/summary/index.md +13 -0
  21. d_safelogger-0.2.0/benchmarks/summary/manifest.json +9 -0
  22. d_safelogger-0.2.0/benchmarks/summary/multiprocess_integrity.md +167 -0
  23. d_safelogger-0.2.0/benchmarks/summary/multiprocess_performance.md +171 -0
  24. d_safelogger-0.2.0/benchmarks/summary/multiprocess_resilience.md +72 -0
  25. d_safelogger-0.2.0/benchmarks/summary/single_process.md +276 -0
  26. d_safelogger-0.2.0/benchmarks/update_summary.py +36 -0
  27. d_safelogger-0.2.0/docs/api/dsafelogger.md +77 -0
  28. d_safelogger-0.2.0/docs/api/dsafelogger__async.md +37 -0
  29. d_safelogger-0.2.0/docs/api/dsafelogger__cli.md +29 -0
  30. d_safelogger-0.2.0/docs/api/dsafelogger__color.md +34 -0
  31. d_safelogger-0.2.0/docs/api/dsafelogger__config_validation.md +47 -0
  32. d_safelogger-0.2.0/docs/api/dsafelogger__constants.md +25 -0
  33. d_safelogger-0.2.0/docs/api/dsafelogger__context.md +35 -0
  34. d_safelogger-0.2.0/docs/api/dsafelogger__env_parser.md +11 -0
  35. d_safelogger-0.2.0/docs/api/dsafelogger__formatter.md +104 -0
  36. d_safelogger-0.2.0/docs/api/dsafelogger__handler.md +26 -0
  37. d_safelogger-0.2.0/docs/api/dsafelogger__ini_loader.md +17 -0
  38. d_safelogger-0.2.0/docs/api/dsafelogger__integrity.md +46 -0
  39. d_safelogger-0.2.0/docs/api/dsafelogger__levels.md +57 -0
  40. d_safelogger-0.2.0/docs/api/dsafelogger__logger.md +18 -0
  41. d_safelogger-0.2.0/docs/api/dsafelogger__mp.md +97 -0
  42. d_safelogger-0.2.0/docs/api/dsafelogger__mp_attach.md +68 -0
  43. d_safelogger-0.2.0/docs/api/dsafelogger__mp_control.md +78 -0
  44. d_safelogger-0.2.0/docs/api/dsafelogger__mp_protocol.md +66 -0
  45. d_safelogger-0.2.0/docs/api/dsafelogger__mp_queue.md +42 -0
  46. d_safelogger-0.2.0/docs/api/dsafelogger__mp_runtime.md +49 -0
  47. d_safelogger-0.2.0/docs/api/dsafelogger__pipeline.md +46 -0
  48. d_safelogger-0.2.0/docs/api/dsafelogger__purge.md +45 -0
  49. d_safelogger-0.2.0/docs/api/dsafelogger__routing.md +128 -0
  50. d_safelogger-0.2.0/docs/api/dsafelogger__sink.md +51 -0
  51. d_safelogger-0.2.0/docs/api/dsafelogger__transport.md +53 -0
  52. d_safelogger-0.2.0/docs/api/dsafelogger__validator.md +11 -0
  53. d_safelogger-0.2.0/docs/api/dsafelogger__writer_formatter.md +43 -0
  54. d_safelogger-0.2.0/docs/api/index.md +35 -0
  55. d_safelogger-0.2.0/docs/design/D-SafeLogger_DetailedDesign_v23j.md +4301 -0
  56. d_safelogger-0.2.0/docs/design/D-SafeLogger_TestDesign_v23j.md +152 -0
  57. d_safelogger-0.2.0/docs/design/D-SafeLogger_v23j_WhitePaper.md +6024 -0
  58. d_safelogger-0.2.0/docs/design/D-SafeLogger_v23j_WhitePaper_en.md +4368 -0
  59. d_safelogger-0.2.0/docs/design/D_SafeLogger_Specification_v23j_full.md +2498 -0
  60. d_safelogger-0.2.0/docs/design/D_SafeLogger_Specification_v23j_full_en.md +2481 -0
  61. d_safelogger-0.2.0/examples/01_quick_start.md +132 -0
  62. d_safelogger-0.2.0/examples/02_configuration_guide.md +262 -0
  63. d_safelogger-0.2.0/examples/03_migration_from_stdlib.md +322 -0
  64. d_safelogger-0.2.0/examples/04_stdlib_ecosystem_coexistence.md +141 -0
  65. d_safelogger-0.2.0/examples/05_windows_service_and_scheduled_batch.md +125 -0
  66. d_safelogger-0.2.0/examples/06_web_api_logging.md +229 -0
  67. d_safelogger-0.2.0/examples/07_long_running_service.md +237 -0
  68. d_safelogger-0.2.0/examples/08_compliance_audit.md +285 -0
  69. d_safelogger-0.2.0/examples/09_debugging_production.md +271 -0
  70. d_safelogger-0.2.0/examples/10_incident_response_bundle.md +147 -0
  71. d_safelogger-0.2.0/examples/11_async_performance.md +183 -0
  72. d_safelogger-0.2.0/examples/12_multiprocess_logging.md +438 -0
  73. d_safelogger-0.2.0/examples/13_external_rotation_reopen.md +82 -0
  74. d_safelogger-0.2.0/examples/14_cli_operations.md +216 -0
  75. d_safelogger-0.2.0/examples/15_opentelemetry_logging.md +195 -0
  76. d_safelogger-0.2.0/examples/16_structlog_coexistence.md +199 -0
  77. d_safelogger-0.2.0/examples/17_container_collector_coexistence.md +110 -0
  78. d_safelogger-0.2.0/pyproject.toml +109 -0
  79. d_safelogger-0.2.0/setup.cfg +4 -0
  80. d_safelogger-0.2.0/src/D_SafeLogger.egg-info/PKG-INFO +295 -0
  81. d_safelogger-0.2.0/src/D_SafeLogger.egg-info/SOURCES.txt +161 -0
  82. d_safelogger-0.2.0/src/D_SafeLogger.egg-info/dependency_links.txt +1 -0
  83. d_safelogger-0.2.0/src/D_SafeLogger.egg-info/entry_points.txt +2 -0
  84. d_safelogger-0.2.0/src/D_SafeLogger.egg-info/top_level.txt +1 -0
  85. d_safelogger-0.2.0/src/dsafelogger/__init__.py +918 -0
  86. d_safelogger-0.2.0/src/dsafelogger/_async.py +102 -0
  87. d_safelogger-0.2.0/src/dsafelogger/_cli.py +271 -0
  88. d_safelogger-0.2.0/src/dsafelogger/_color.py +71 -0
  89. d_safelogger-0.2.0/src/dsafelogger/_config_validation.py +177 -0
  90. d_safelogger-0.2.0/src/dsafelogger/_constants.py +48 -0
  91. d_safelogger-0.2.0/src/dsafelogger/_context.py +80 -0
  92. d_safelogger-0.2.0/src/dsafelogger/_env_parser.py +135 -0
  93. d_safelogger-0.2.0/src/dsafelogger/_formatter.py +381 -0
  94. d_safelogger-0.2.0/src/dsafelogger/_handler.py +205 -0
  95. d_safelogger-0.2.0/src/dsafelogger/_ini_loader.py +474 -0
  96. d_safelogger-0.2.0/src/dsafelogger/_integrity.py +107 -0
  97. d_safelogger-0.2.0/src/dsafelogger/_levels.py +204 -0
  98. d_safelogger-0.2.0/src/dsafelogger/_logger.py +35 -0
  99. d_safelogger-0.2.0/src/dsafelogger/_mp_attach.py +459 -0
  100. d_safelogger-0.2.0/src/dsafelogger/_mp_control.py +181 -0
  101. d_safelogger-0.2.0/src/dsafelogger/_mp_protocol.py +208 -0
  102. d_safelogger-0.2.0/src/dsafelogger/_mp_queue.py +93 -0
  103. d_safelogger-0.2.0/src/dsafelogger/_mp_runtime.py +590 -0
  104. d_safelogger-0.2.0/src/dsafelogger/_pipeline.py +243 -0
  105. d_safelogger-0.2.0/src/dsafelogger/_purge.py +200 -0
  106. d_safelogger-0.2.0/src/dsafelogger/_routing.py +392 -0
  107. d_safelogger-0.2.0/src/dsafelogger/_sink.py +116 -0
  108. d_safelogger-0.2.0/src/dsafelogger/_transport.py +170 -0
  109. d_safelogger-0.2.0/src/dsafelogger/_validator.py +57 -0
  110. d_safelogger-0.2.0/src/dsafelogger/_writer_formatter.py +158 -0
  111. d_safelogger-0.2.0/src/dsafelogger/mp/__init__.py +948 -0
  112. d_safelogger-0.2.0/src/dsafelogger/py.typed +1 -0
  113. d_safelogger-0.2.0/tests/conftest.py +98 -0
  114. d_safelogger-0.2.0/tests/examples/test_03_migration_from_stdlib.py +31 -0
  115. d_safelogger-0.2.0/tests/examples/test_04_stdlib_ecosystem_coexistence.py +52 -0
  116. d_safelogger-0.2.0/tests/examples/test_05_windows_service_and_scheduled_batch.py +38 -0
  117. d_safelogger-0.2.0/tests/examples/test_06_web_api_logging.py +60 -0
  118. d_safelogger-0.2.0/tests/examples/test_07_long_running_service.py +31 -0
  119. d_safelogger-0.2.0/tests/examples/test_08_compliance_audit.py +46 -0
  120. d_safelogger-0.2.0/tests/examples/test_09_debugging_production.py +46 -0
  121. d_safelogger-0.2.0/tests/examples/test_10_incident_response_bundle.py +61 -0
  122. d_safelogger-0.2.0/tests/examples/test_11_async_performance.py +47 -0
  123. d_safelogger-0.2.0/tests/examples/test_12_multiprocess_logging.py +58 -0
  124. d_safelogger-0.2.0/tests/examples/test_13_external_rotation_reopen.py +27 -0
  125. d_safelogger-0.2.0/tests/examples/test_14_cli_operations.py +31 -0
  126. d_safelogger-0.2.0/tests/examples/test_15_opentelemetry_logging.py +68 -0
  127. d_safelogger-0.2.0/tests/examples/test_16_structlog_coexistence.py +51 -0
  128. d_safelogger-0.2.0/tests/examples/test_17_container_collector_coexistence.py +35 -0
  129. d_safelogger-0.2.0/tests/test_async.py +143 -0
  130. d_safelogger-0.2.0/tests/test_cli.py +68 -0
  131. d_safelogger-0.2.0/tests/test_color.py +267 -0
  132. d_safelogger-0.2.0/tests/test_configure.py +194 -0
  133. d_safelogger-0.2.0/tests/test_context.py +144 -0
  134. d_safelogger-0.2.0/tests/test_coverage_boost.py +850 -0
  135. d_safelogger-0.2.0/tests/test_diagnose.py +66 -0
  136. d_safelogger-0.2.0/tests/test_env_parser.py +154 -0
  137. d_safelogger-0.2.0/tests/test_formatter.py +370 -0
  138. d_safelogger-0.2.0/tests/test_getlogger.py +57 -0
  139. d_safelogger-0.2.0/tests/test_handler.py +231 -0
  140. d_safelogger-0.2.0/tests/test_ini_loader.py +175 -0
  141. d_safelogger-0.2.0/tests/test_integration.py +230 -0
  142. d_safelogger-0.2.0/tests/test_integrity.py +153 -0
  143. d_safelogger-0.2.0/tests/test_levels.py +138 -0
  144. d_safelogger-0.2.0/tests/test_logger.py +43 -0
  145. d_safelogger-0.2.0/tests/test_merge.py +57 -0
  146. d_safelogger-0.2.0/tests/test_mp_attach.py +381 -0
  147. d_safelogger-0.2.0/tests/test_mp_configure.py +320 -0
  148. d_safelogger-0.2.0/tests/test_mp_control.py +170 -0
  149. d_safelogger-0.2.0/tests/test_mp_fork.py +143 -0
  150. d_safelogger-0.2.0/tests/test_mp_formatter.py +180 -0
  151. d_safelogger-0.2.0/tests/test_mp_integration.py +384 -0
  152. d_safelogger-0.2.0/tests/test_mp_runtime.py +1562 -0
  153. d_safelogger-0.2.0/tests/test_mp_spawn_windows.py +192 -0
  154. d_safelogger-0.2.0/tests/test_opentelemetry.py +124 -0
  155. d_safelogger-0.2.0/tests/test_pipeline.py +77 -0
  156. d_safelogger-0.2.0/tests/test_purge.py +130 -0
  157. d_safelogger-0.2.0/tests/test_reopen.py +156 -0
  158. d_safelogger-0.2.0/tests/test_routing.py +202 -0
  159. d_safelogger-0.2.0/tests/test_structlog.py +134 -0
  160. d_safelogger-0.2.0/tests/test_transport.py +149 -0
  161. d_safelogger-0.2.0/tests/test_validator.py +74 -0
  162. d_safelogger-0.2.0/tests/test_version.py +9 -0
  163. d_safelogger-0.2.0/uv.lock +488 -0
@@ -0,0 +1,192 @@
1
+ # Benchmark Analysis
2
+
3
+ This document is the public benchmark analysis for D-SafeLogger. It is manually edited and is intended to be usable as the basis for README benchmark claims.
4
+
5
+ Benchmark facts are kept separately from this analysis:
6
+
7
+ - Per-run artifacts: [`benchmarks/results/`](benchmarks/results/)
8
+ - Selected-session manifest: [`benchmarks/summary/manifest.json`](benchmarks/summary/manifest.json)
9
+ - Generated summary index: [`benchmarks/summary/index.md`](benchmarks/summary/index.md)
10
+
11
+ ## Executive Summary
12
+
13
+ D-SafeLogger is competitive in single-process logging, especially in async mode and single-thread workloads. In the selected single-process run, D-SafeLogger async was the throughput leader in 8/16 cells and achieved the lowest p50 latency in 12/16 cells. D-SafeLogger async also beat D-SafeLogger sync in both throughput and p50 latency in all 16 comparable cells.
14
+
15
+ Multiprocess results should be interpreted differently. D-SafeLogger is not the fastest multiprocess backend in this benchmark; stdlib logging leads throughput in all measured multiprocess performance cells. D-SafeLogger's multiprocess value is not raw speed. Its value is Writer-owned sinks, explicit attach/detach, bounded shutdown, and classified delivery-state observability under operational stress.
16
+
17
+ The resilience profile is the strongest multiprocess evidence. Across 12 D-SafeLogger resilience summary rows, D-SafeLogger produced classified loss/reject/drop fields for 12/12 rows and fully explained 12/12 rows. That is the benchmark-backed claim: D-SafeLogger can explain what happened to records under backpressure, sink rejection, and mixed worker shutdown, instead of leaving delivery state ambiguous.
18
+
19
+ ## Published Summaries
20
+
21
+ - Single-process comparison: [`benchmarks/summary/single_process.md`](benchmarks/summary/single_process.md)
22
+ - Multiprocess integrity profile: [`benchmarks/summary/multiprocess_integrity.md`](benchmarks/summary/multiprocess_integrity.md)
23
+ - Multiprocess performance profile: [`benchmarks/summary/multiprocess_performance.md`](benchmarks/summary/multiprocess_performance.md)
24
+ - Multiprocess resilience profile: [`benchmarks/summary/multiprocess_resilience.md`](benchmarks/summary/multiprocess_resilience.md)
25
+
26
+ ## Selected Runs
27
+
28
+ | Category | Selected Session | Purpose |
29
+ |---|---|---|
30
+ | Single-process | `benchmark_20260506_180018` | Throughput and latency comparison across D-SafeLogger, stdlib logging, loguru, and structlog |
31
+ | Multiprocess integrity | `benchmarks_multi_integ_20260506_185947` | Normal-condition delivery completeness and JSON/route integrity |
32
+ | Multiprocess performance | `benchmarks_multi_perf_20260506_190518` | Raw multiprocess throughput and latency comparison |
33
+ | Multiprocess resilience | `benchmarks_multi_resilience_20260506_211129` | Operational failure-mode observability and classified delivery state |
34
+
35
+ The selected sessions are controlled by [`benchmarks/summary/manifest.json`](benchmarks/summary/manifest.json). Running a new benchmark does not automatically change the public analysis.
36
+
37
+ Selection rationale:
38
+
39
+ - The selected sessions were refreshed together after the v23i publication-readiness fixes so the public summaries and analysis use one current benchmark set.
40
+ - A benchmark session should only replace a selected session when it is intentionally promoted in the manifest and this analysis is reviewed for updated claims.
41
+
42
+ ## Single-Process Results
43
+
44
+ The single-process benchmark covers Python 3.13 and 3.14, GIL enabled and disabled, text and JSON output, single-thread and multi-thread workloads, and sync/async modes where applicable.
45
+
46
+ Key results from the selected run:
47
+
48
+ - D-SafeLogger async beat D-SafeLogger sync on throughput in 16/16 comparable cells.
49
+ - D-SafeLogger async beat D-SafeLogger sync on p50 latency in 16/16 comparable cells.
50
+ - Throughput leaders across all 16 cells: D-SafeLogger async 8/16, structlog sync 5/16, stdlib logging async 3/16.
51
+ - Best D-SafeLogger mode beat all non-D-SafeLogger backends on throughput in 8/16 cells.
52
+ - Best D-SafeLogger mode achieved the lowest p50 latency in 12/16 cells.
53
+
54
+ The strongest D-SafeLogger single-process result is Python 3.14 with GIL enabled:
55
+
56
+ | Scenario | D-SafeLogger Mode | Throughput | p50 | p90 | p99 |
57
+ |---|---|---:|---:|---:|---:|
58
+ | text | async | 51,554 msg/s | 16.7 us | 19.6 us | 39.6 us |
59
+ | JSON | async | 52,081 msg/s | 16.7 us | 19.2 us | 36.8 us |
60
+
61
+ Interpretation:
62
+
63
+ - D-SafeLogger async is the preferred high-throughput single-process mode in this benchmark.
64
+ - D-SafeLogger's strongest area is low-latency single-process logging, especially under Python 3.14/GIL enabled.
65
+ - Multi-thread throughput is not universally led by D-SafeLogger. structlog sync is strong in several multi-thread cells, and stdlib logging async wins some Python 3.14/GIL enabled multi-thread cells.
66
+ - The correct single-process claim is "competitive and often fastest in low-latency async single-process logging," not "always fastest."
67
+
68
+ ## Multiprocess Integrity Results
69
+
70
+ The integrity profile checks normal-condition delivery completeness and structured output integrity across D-SafeLogger, stdlib logging, and loguru.
71
+
72
+ Selected result summary:
73
+
74
+ | Backend | Raw Runs | Failures | Missing | Duplicates | JSON Parse | Route Mismatch |
75
+ |---|---:|---:|---:|---:|---:|---:|
76
+ | D-SafeLogger | 96 | 0 | 0 | 0 | 0 | 0 |
77
+ | stdlib logging | 96 | 0 | 0 | 0 | 0 | 0 |
78
+ | loguru | 96 | 0 | 0 | 0 | 0 | 0 |
79
+
80
+ Interpretation:
81
+
82
+ - Under normal benchmark conditions, all three backends delivered the expected records without missing, duplicate, JSON parse, or route mismatch anomalies.
83
+ - This profile is a correctness gate, not D-SafeLogger's differentiating claim.
84
+ - The result supports that D-SafeLogger's Writer-based multiprocess architecture preserves normal delivery integrity, but it should not be used to claim uniqueness.
85
+
86
+ ## Multiprocess Performance Results
87
+
88
+ The multiprocess performance profile measures raw throughput and latency for process counts and routing patterns. In this profile, stdlib logging wins throughput in all measured cells.
89
+
90
+ Average throughput by pattern and scenario:
91
+
92
+ | Pattern | Scenario | D-SafeLogger avg | stdlib avg | loguru avg | Throughput Wins (DS/std/loguru) |
93
+ |---|---:|---:|---:|---:|---:|
94
+ | root_p1 | text | 797 | 1,280 | 995 | 0/4/0 |
95
+ | root_p1 | JSON | 803 | 1,253 | 1,009 | 0/4/0 |
96
+ | root_p4 | text | 653 | 1,110 | 849 | 0/4/0 |
97
+ | root_p4 | JSON | 659 | 1,134 | 874 | 0/4/0 |
98
+ | root_p8 | text | 468 | 852 | 650 | 0/4/0 |
99
+ | root_p8 | JSON | 456 | 802 | 656 | 0/4/0 |
100
+ | module_p4 | text | 644 | 1,120 | 872 | 0/4/0 |
101
+ | module_p4 | JSON | 643 | 1,084 | 878 | 0/4/0 |
102
+
103
+ Interpretation:
104
+
105
+ - D-SafeLogger multiprocess mode has measurable fixed costs: record serialization, client-to-writer IPC, route dispatch, Writer-side reconstruction, sink classification, and close-marker drain accounting.
106
+ - Those costs are intentional tradeoffs for central sink ownership and delivery-state observability.
107
+ - The correct multiprocess performance claim is not "fastest." The correct claim is "controlled, observable, Writer-owned multiprocess logging with explicit failure accounting."
108
+
109
+ ## Multiprocess Resilience Results
110
+
111
+ The resilience profile measures what can be explained during operational stress. This is the most important multiprocess benchmark for D-SafeLogger's design goals.
112
+
113
+ Selected result summary:
114
+
115
+ - D-SafeLogger produced classified loss/reject/drop fields for 12/12 summary rows.
116
+ - D-SafeLogger fully explained 12/12 summary rows.
117
+ - stdlib logging and loguru rows are marked `observability_gap` where accepted/dropped/unexplained state cannot be classified by the benchmarked backend contract.
118
+
119
+ Representative D-SafeLogger rows:
120
+
121
+ | Scenario | Python/GIL | Attempted | Accepted | Delivered | KnownRejected | KnownDropped | UnexplainedLost | Shutdown |
122
+ |---|---|---:|---:|---:|---:|---:|---:|---|
123
+ | burst_backpressure | 3.13/enabled | 100 | 100 | 99 | 0 | 1 | 0 | clean |
124
+ | burst_backpressure | 3.14/enabled | 100 | 100 | 100 | 0 | 0 | 0 | clean |
125
+ | burst_backpressure | 3.14/disabled | 100 | 100 | 100 | 0 | 0 | 0 | clean |
126
+ | rolling_restart_mixed_shutdown | all measured | 62 | 62 | 62 | 0 | 0 | 0 | clean_with_worker_crash |
127
+ | sink_temporarily_unavailable | all measured | 100 | 100 | 0 | 100 | 0 | 0 | clean |
128
+
129
+ Interpretation:
130
+
131
+ - In backpressure scenarios, D-SafeLogger may drop records, but the drops are classified as known drops rather than unexplained loss.
132
+ - In mixed shutdown scenarios, D-SafeLogger can distinguish a clean writer shutdown with worker crash/termination from unexplained record loss.
133
+ - In sink-unavailable scenarios, D-SafeLogger classifies rejected records as known sink rejects rather than reporting ambiguous loss.
134
+ - This is the core multiprocess claim: D-SafeLogger does not promise impossible failure-free logging; it promises explicit accounting of what happened.
135
+
136
+ ## What To Claim
137
+
138
+ - D-SafeLogger has zero runtime dependencies.
139
+ - D-SafeLogger provides append-only file handling without rename/truncate rotation.
140
+ - D-SafeLogger supports structured JSON logging and stdlib-compatible logger integration.
141
+ - D-SafeLogger async is competitive in single-process logging and leads several low-latency cells in the selected benchmark.
142
+ - D-SafeLogger multiprocess mode centralizes sink ownership in a Writer runtime.
143
+ - D-SafeLogger multiprocess resilience profiling exposes classified delivery-state counters: attempted, accepted, delivered, known rejected, known dropped, and unexplained lost.
144
+
145
+ ## What Not To Claim
146
+
147
+ - Do not claim D-SafeLogger is always the fastest backend.
148
+ - Do not claim D-SafeLogger multiprocess mode beats stdlib logging on raw throughput in this benchmark.
149
+ - Do not claim multiprocess logging can never lose records under operational failure.
150
+ - Do not claim sink outage, worker crash, or hard process termination is made impossible.
151
+ - Do not mix diagnostic benchmark results with normal logging throughput results.
152
+
153
+ ## Reproduction
154
+
155
+ Official tests use the dev dependency group. The library runtime remains dependency-free; the test environment does not.
156
+
157
+ ```bash
158
+ uv sync --group dev
159
+ uv run pytest tests -v
160
+ ```
161
+
162
+ Single-process benchmark:
163
+
164
+ ```bash
165
+ uv sync --group benchmark
166
+ uv run python benchmarks/run_benchmark.py
167
+ ```
168
+
169
+ Multiprocess resilience benchmark:
170
+
171
+ ```bash
172
+ uv sync --group benchmark
173
+ uv run python benchmarks/run_multiprocess_compare_v23a.py --repo-root . --profile resilience_profile --messages 100 --repeat 1
174
+ ```
175
+
176
+ Regenerate selected summary files from the manifest:
177
+
178
+ ```bash
179
+ uv run python benchmarks/update_summary.py
180
+ ```
181
+
182
+ ## Maintenance Model
183
+
184
+ Benchmark runners write session artifacts under `benchmarks/results/`. They do not edit this document.
185
+
186
+ To promote a benchmark run into the public summary:
187
+
188
+ 1. Add or update the session name in `benchmarks/summary/manifest.json`.
189
+ 2. Run `uv run python benchmarks/update_summary.py`.
190
+ 3. Review the generated files in `benchmarks/summary/`.
191
+ 4. Manually update this analysis only when the interpretation or published claim changes.
192
+ 5. When promoted benchmark values are cited in `README.md` or `README_ja.md`, update those README claims in the same change.
@@ -0,0 +1,68 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.2.0] - 2026-05-05
9
+
10
+ ### Added
11
+ - Formal multiprocess public API under `dsafelogger.mp`, including `ConfigureLogger`, `AttachCurrentProcess`, `DetachCurrentProcess`, `GetLogger`, `GetWorkerInitializer`, and `ReopenLogFiles`.
12
+ - Writer-runtime multiprocess architecture with separate log plane and control plane, CloseMarker-based drain, explicit attach/detach, and bounded shutdown behavior.
13
+ - Classified multiprocess delivery-state counters for route/reconstruct/close-marker/sink/policy rejects, partial delivery, best-effort failures, timeout drops, overload shed, and drain-deadline loss.
14
+ - `TrackedQueue` for qsize-visible multiprocess log queues with platform fallback.
15
+ - Multiprocess comparison benchmark runner at `benchmarks/run_multiprocess_compare_v23a.py` with integrity, performance, overload, and resilience profiles.
16
+ - Benchmark summary manifest workflow via `benchmarks/summary/manifest.json` and `benchmarks/update_summary.py`.
17
+ - Generated benchmark summary documents under `benchmarks/summary/` while keeping `BENCHMARK.md` manually edited.
18
+ - `optional_integration` pytest marker for OpenTelemetry and structlog coexistence tests while keeping them in the official full test run.
19
+ - v23j public design documents under `docs/design/` reflecting formal MP, dev full-test policy, manifest-based benchmark publication, and strict invalid-configuration handling.
20
+ - Shared v23j configuration validation for single-process, module-specific, and multiprocess file sinks.
21
+ - Generated API documentation under `docs/api/` with `scripts/generate_api_docs.py --check`.
22
+ - Public design-document readiness check via `scripts/check_design_docs_sync.py`.
23
+ - Multiprocess and external-rotation tutorials covering `dsafelogger.mp` and `ReopenLogFiles()`.
24
+
25
+ ### Changed
26
+ - Updated `README.md`, `README_ja.md`, `TESTING.md`, and `BENCHMARK.md` to describe the current v23j design, test policy, benchmark interpretation, and formal multiprocess support.
27
+ - Invalid routing/generation/hash combinations are now fail-fast `ValueError` cases instead of warnings or silent no-ops.
28
+ - `structured=True` is mutually exclusive with `fmt`, `file_fmt`, and `console_fmt` after all config layers are merged.
29
+ - `file_fmt` and `console_fmt` are now accepted by the single-process API and INI/config_dict loader, matching the public design docs.
30
+ - Multiprocess module-specific levels are propagated to attached worker loggers.
31
+ - Multiprocess spawn integration tests now use the same multiprocessing context for Writer IPC primitives and worker process creation.
32
+ - Multiprocess log queue creation now classifies platform-rejected `ipc_log_queue_maxsize` values as `ValueError` before Writer sinks are started, while preserving runtime errors for non-validation OS failures.
33
+ - Tests no longer depend on `multiprocessing.Queue.empty()` for correctness.
34
+ - Benchmark runners now write session artifacts only; they no longer regenerate top-level `BENCHMARK.md`.
35
+ - Official testing policy is now `uv sync --group dev` followed by the full `uv run pytest tests -v` run.
36
+ - Package metadata version and public `dsafelogger.__version__` are both `0.2.0`; project classifier is now Beta.
37
+ - Package license metadata now uses SPDX `license = "Apache-2.0"` and `license-files = ["LICENSE"]`.
38
+ - GitHub CI now checks generated API docs, design-document sync, benchmark summaries, and package build output.
39
+ - PyPI publish workflow now verifies tag/version consistency and repeats publication preflight checks before publishing.
40
+ - GitHub CI now includes Ubuntu free-threaded CPython `3.13t` and `3.14t` test jobs with `PYTHON_GIL=0`.
41
+
42
+ ### Verified
43
+ - Full local v23j validation on Python 3.14.3 / Windows: `651 passed, 3 skipped` (`654` collected). Skip counts can vary by platform because fork tests are POSIX-only and Windows spawn tests are Windows-only.
44
+ - Targeted v23j configuration validation: `256 passed` across configure, routing, INI, reopen, and MP integration tests.
45
+ - Coverage validation regenerated `coverage.xml`: terminal total `86%`, line-rate `88.49%`, branch-rate `80.53%`.
46
+ - Targeted regression validation for MP runtime, MP integration, OpenTelemetry, and structlog tests: `91 passed`.
47
+ - Benchmark summary manifest generation and `--check` verification pass.
48
+
49
+ ## [0.1.0] - 2026-04-03
50
+
51
+ ### Added
52
+ - Initial release
53
+ - 3-layer configuration pipeline (Environment → INI/Dict → Arguments)
54
+ - 9 routing strategies (none, daily, hourly, min_interval, startup_interval, size, count, cyclic_weekday, cyclic_month)
55
+ - Append-only file handler (Windows lock-safe)
56
+ - SHA-256 integrity verification with sidecar files and manifest
57
+ - Structured JSON Lines output
58
+ - Diagnostic formatter with f_locals expansion and sensitive data masking
59
+ - ANSI color console output with customizable palette
60
+ - Async logging mode with context-preserving QueueHandler
61
+ - Custom log level registration with `register_level()`
62
+ - `contextualize()` context manager for structured log context
63
+ - CLI tool (`dsafelogger init/ls/tail -f`)
64
+ - Free-threaded Python (3.13t/3.14t) support with explicit locks
65
+ - Per-module log level and file routing
66
+ - INI file and dict-based configuration
67
+ - Safe shutdown with worker thread join
68
+ - Complete standard library `logging` compatibility
@@ -0,0 +1,78 @@
1
+ # Contributing to D-SafeLogger
2
+
3
+ Thank you for your interest in contributing to D-SafeLogger!
4
+ This project prioritises **stability, zero-dependency purity, and architectural clarity** above all else.
5
+ Every change is evaluated against those pillars — please read this guide before opening an issue or pull request.
6
+
7
+ ## 1. Understand the Design Principles
8
+
9
+ Before contributing, familiarise yourself with the **Compatibility** and **Non-Goals** sections in
10
+ [README.md](README.md). D-SafeLogger is a drop-in enhancement for Python's standard `logging`
11
+ module, and its scope is intentionally narrow.
12
+
13
+ ## 2. Contribution Flow: Issue-First Policy
14
+
15
+ 1. **Open an Issue or Discussion first** — describe what you want to change and why.
16
+ 2. **Wait for consensus** — a maintainer will triage and discuss feasibility.
17
+ 3. **PRs by invitation** — once the issue is accepted, you will be invited to submit a PR.
18
+
19
+ > ⚠️ **Unsolicited pull requests** (those without a prior accepted issue) **may be closed without review.**
20
+ > This is not meant to discourage contributions — it ensures every change aligns with the project's direction.
21
+
22
+ ## 3. Where to Start?
23
+
24
+ ### Directly Welcome (Open an Issue)
25
+
26
+ - **Bug reports** — include a minimal reproducible example, Python version, and OS.
27
+ - **Documentation improvements** — typo fixes, clarifications, better examples.
28
+ - **Security concerns** — please report responsibly via [SECURITY.md](SECURITY.md) or private disclosure.
29
+
30
+ ### Requires Discussion First
31
+
32
+ - **Features not in current scope** — propose in a Discussion before writing code.
33
+ - **Architecture changes** — structural modifications need explicit design approval.
34
+ - **New dependencies** — almost certainly rejected. D-SafeLogger follows a strict **zero-dependency policy**.
35
+
36
+ ## 4. Core Constraints
37
+
38
+ All contributions **must** respect these invariants:
39
+
40
+ 1. **Zero-dependency** — Python standard library only. No exceptions.
41
+ 2. **Fail-fast configuration** — errors must raise immediately, not fail silently.
42
+ 3. **Thread safety** — all shared state protected by explicit locks (no GIL reliance).
43
+ 4. **Append-only invariant** — log files must never be renamed or truncated.
44
+ 5. **`logging` compatibility** — must remain a drop-in enhancement for stdlib `logging`.
45
+
46
+ ## 5. Development Setup
47
+
48
+ ```bash
49
+ git clone https://github.com/<your-username>/D-SafeLogger.git
50
+ cd D-SafeLogger
51
+ uv sync --group dev
52
+ uv run pytest tests/ -v
53
+ uv run ruff check src/ tests/
54
+ ```
55
+
56
+ ## 6. Code Style
57
+
58
+ - **PEP 8**, max **100** characters per line.
59
+ - **ruff** for linting (`uv run ruff check src/ tests/`).
60
+ - **Type hints required** — use Python 3.11+ `X | Y` union syntax.
61
+
62
+ ## 7. Pull Request Process
63
+
64
+ 1. Create a feature branch from `main`.
65
+ 2. Add tests for new functionality.
66
+ 3. Ensure **all** tests pass: `uv run pytest tests/ -v`.
67
+ 4. Update documentation if needed.
68
+ 5. Submit a PR with a clear description referencing the accepted issue.
69
+
70
+ ## License
71
+
72
+ By contributing, you agree that your contributions will be licensed under the
73
+ [Apache License 2.0](LICENSE).
74
+
75
+ ---
76
+
77
+ *D-SafeLogger is currently in a **stability-first phase**.
78
+ New features are accepted conservatively — quality and reliability come first.*
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 D
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,60 @@
1
+ include LICENSE
2
+ include README.md
3
+ include README_ja.md
4
+ include CHANGELOG.md
5
+ include TESTING.md
6
+ include CONTRIBUTING.md
7
+ include SECURITY.md
8
+ include BENCHMARK.md
9
+ include pyproject.toml
10
+ include uv.lock
11
+
12
+ graft docs
13
+ graft examples
14
+ graft tests
15
+ graft benchmarks/summary
16
+
17
+ # Summary regeneration/check scripts required for verifying selected summaries
18
+ # from the sdist without the full benchmark runner set.
19
+ include benchmarks/_benchmark_report.py
20
+ include benchmarks/update_summary.py
21
+
22
+ # Selected-session raw summaries referenced by benchmarks/summary/manifest.json.
23
+ # Required for `python benchmarks/update_summary.py --check` to pass from sdist.
24
+ include benchmarks/results/benchmark_20260506_180018/summary.json
25
+ include benchmarks/results/benchmark_20260506_180018/summary.md
26
+ include benchmarks/results/benchmarks_multi_integ_20260506_185947/summary.json
27
+ include benchmarks/results/benchmarks_multi_integ_20260506_185947/summary.md
28
+ include benchmarks/results/benchmarks_multi_perf_20260506_190518/summary.json
29
+ include benchmarks/results/benchmarks_multi_perf_20260506_190518/summary.md
30
+ include benchmarks/results/benchmarks_multi_resilience_20260506_211129/summary.json
31
+ include benchmarks/results/benchmarks_multi_resilience_20260506_211129/summary.md
32
+
33
+ prune .claude
34
+ prune .github
35
+ prune .pytest_cache
36
+ prune .ruff_cache
37
+ prune .venv
38
+ prune .venv_311
39
+ prune .verify_task
40
+ prune _examples_extracted
41
+ prune _src_extracted
42
+ prune _tests_extracted
43
+ prune build
44
+ prune dist
45
+ prune docs/design/old
46
+ prune plan
47
+ prune tests/__pycache__
48
+
49
+ exclude App.log
50
+ exclude BENCHMARK_anomaly_*.md
51
+ exclude BENCHMARK_legacy_*.md
52
+ exclude _gen_api_docs.py
53
+ exclude *.zip
54
+ global-exclude __pycache__
55
+ global-exclude *.py[cod]
56
+ global-exclude *.pyc.*
57
+ global-exclude .DS_Store
58
+ global-exclude Thumbs.db
59
+ global-exclude .coverage
60
+ global-exclude coverage.xml