Persists a shieldr_audit object as JSON Lines, CSV, or RDS for operational
auditability across LLM workflows.
Details
JSON Lines is the preferred append-only format for production logs because each call writes one complete audit object as one line. CSV flattens findings into one row per finding, which is convenient for spreadsheets and simple dashboards but loses some nested structure. The CSV path preserves common metadata such as context row index, context source, tool name, conversation role, and reviewer error counts. RDS preserves the R object exactly and overwrites the target path.
By default, content is stripped again before writing, including when an
older or explicitly full-content audit object is supplied. To persist raw
content, the caller must set include_content = TRUE explicitly and protect
the destination path.
Examples
audit <- shieldr_audit(NULL, NULL, NULL, "hello", NULL, 0, 1L, "allow")
path <- tempfile(fileext = ".jsonl")
write_audit_log(audit, path)
