Follow-up to #2478 (merge commit e8f27c73).
When @jensenpat landed the AsyncLogWriter foundation, he mentioned validating it via a throwaway probe — verifying token redaction, IPv4/serial/MAC redaction, and that clearLog() truncates prior buffered writes while preserving subsequent ones. The probe wasn't committed.
The class is well-suited to unit testing in isolation since the public API is deterministic when called serially:
AsyncLogWriter w;
w.start("/tmp/test.log", false);
w.enqueue(QtDebugMsg, QTime::currentTime(), "test", "hello 192.168.1.123");
w.flush();
QFile f("/tmp/test.log"); f.open(QIODevice::ReadOnly);
QVERIFY(f.readAll().contains("*.*.*. 123"));
w.shutdown();
Suggested test cases
- Format preservation: produced line matches
[HH:mm:ss.zzz] DBG aether.x: msg\n shape exactly
- PII redaction:
- IPv4:
192.168.50.121 → *.*.*. 121
- IPv4 ver-prefix exemption:
software_ver=4.2.18.41174 is NOT redacted
- IPv4 quoted exemption:
"0.9.8" is NOT redacted
- Serial:
4424-1213-8600-7836 → ****-****-****-7836
- Token:
id_token=ABCDEF12345...long string → id_token= ABCDEF...REDACTED
- MAC dash:
00-1C-2D-05-37-2A → **-**-**-**-**-2A
- MAC colon:
00:1C:2D:05:37:2A → **:**:**:**:**:2A
- clearLog determinism: enqueue lines → clearLog → enqueue more → file contains only the post-clear lines
- Drop accounting: enqueue more than
kHardMaxQueueEntries warn/crit lines → counters reflect drops, summary line emitted
- High-priority reserve: enqueue 8192 debug + 1 critical → critical is preserved; counter shows debug drops only
- Shutdown ordering: enqueue → shutdown → file contains all enqueued lines (no loss on graceful stop)
- Stderr mirroring: when
mirrorToStderr=true, captured stderr matches file content
Test file would live at tests/async_log_writer_test.cpp, registered in CMakeLists.txt as add_executable(async_log_writer_test ...) per the existing test pattern.
Priority
Low. AsyncLogWriter is exercised constantly in production runs so behavioral regressions surface fast. But unit coverage would catch redaction-regex regressions before they ship — those are the most likely target for future tightening.
73, Jeremy KK7GWY & Claude (AI dev partner)
Follow-up to #2478 (merge commit
e8f27c73).When @jensenpat landed the AsyncLogWriter foundation, he mentioned validating it via a throwaway probe — verifying token redaction, IPv4/serial/MAC redaction, and that
clearLog()truncates prior buffered writes while preserving subsequent ones. The probe wasn't committed.The class is well-suited to unit testing in isolation since the public API is deterministic when called serially:
Suggested test cases
[HH:mm:ss.zzz] DBG aether.x: msg\nshape exactly192.168.50.121→*.*.*. 121software_ver=4.2.18.41174is NOT redacted"0.9.8"is NOT redacted4424-1213-8600-7836→****-****-****-7836id_token=ABCDEF12345...long string→id_token= ABCDEF...REDACTED00-1C-2D-05-37-2A→**-**-**-**-**-2A00:1C:2D:05:37:2A→**:**:**:**:**:2AkHardMaxQueueEntrieswarn/crit lines → counters reflect drops, summary line emittedmirrorToStderr=true, captured stderr matches file contentTest file would live at
tests/async_log_writer_test.cpp, registered in CMakeLists.txt asadd_executable(async_log_writer_test ...)per the existing test pattern.Priority
Low. AsyncLogWriter is exercised constantly in production runs so behavioral regressions surface fast. But unit coverage would catch redaction-regex regressions before they ship — those are the most likely target for future tightening.
73, Jeremy KK7GWY & Claude (AI dev partner)