Skip to main content

audit_file_path

Function audit_file_path 

Source
pub fn audit_file_path() -> Option<PathBuf>
Expand description

Resolves the audit log file path.

OMNI_DEV_AUDIT_LOG_FILE override, else state_dir (falling back to data_dir) joined with omni-dev/audit.jsonl — a sibling of log_file_path’s default, resolved through the same two helpers so the two sinks’ policy can’t drift apart. Since either can be redirected independently via its own env override, nothing here guarantees the two stay distinct; record_audit checks that at write time instead of merely assuming it.

The body is the same in every build; only test_audit_file_override differs. In a release build it is always None, so the env override and the real default are all there is. In a test build it routes per thread (see that function): a thread that opted into nothing is pinned to a shared scratch file and never sees the env var or the real default, so no test can pollute another’s file — or the machine’s — by omission.