Skip to main content

record

Function record 

Source
pub async fn record(
    pool: &Pool,
    page_id: i64,
    action: &str,
    actor_id: Option<i64>,
    message: impl Into<String>,
    data: Option<Value>,
) -> Result<(), ExecError>
Expand description

Insert a log entry. Best-effort; on failure logs + returns Ok so the call-site doesn’t have to special-case audit-write errors.

data is serialised into the data_json column. Pass None for “no extra metadata”; pass any serde_json::Value otherwise.

§Errors

Driver / query failures bubble up — callers typically let _ = the result so audit failures don’t abort the underlying action.