pub struct AuditEvent { /* private fields */ }Expand description
The app’s own event for the audit log of a panel with
audit_trail: a sign-in, an export, a payment, beside
what the panel’s writes record.
AuditEvent::new("export")
.resource("orders")
.record(cx, ex)
.await?;Implementations§
Source§impl AuditEvent
impl AuditEvent
Sourcepub fn new(event: impl Into<String>) -> Self
pub fn new(event: impl Into<String>) -> Self
An event named event, on no resource: the log shows the name as it is.
Sourcepub fn resource(self, slug: impl Into<String>) -> Self
pub fn resource(self, slug: impl Into<String>) -> Self
The slug of the resource it happened to: only readers who may list that resource see it.
Sourcepub fn key(self, key: impl Into<String>, url: Option<String>) -> Self
pub fn key(self, key: impl Into<String>, url: Option<String>) -> Self
The key of the record it happened to, and its page when it has one.
Sourcepub fn change(
self,
field: impl Into<String>,
label: impl Into<String>,
before: Option<String>,
after: Option<String>,
) -> Self
pub fn change( self, field: impl Into<String>, label: impl Into<String>, before: Option<String>, after: Option<String>, ) -> Self
A field it changed, from before to after.
Sourcepub async fn record(self, cx: &Cx, ex: &mut dyn Executor) -> Result<AuditEntry>
pub async fn record(self, cx: &Cx, ex: &mut dyn Executor) -> Result<AuditEntry>
Stores the event for the request’s panel, its actor and the
tenant they act for, through ex: the write’s transaction inside a
CommitHook or
Resource::before_commit, or the panel’s
Db outside one.
§Errors
A declaration error outside every panel; the driver’s failure when the row cannot be written.
Trait Implementations§
Source§impl Clone for AuditEvent
impl Clone for AuditEvent
Auto Trait Implementations§
impl Freeze for AuditEvent
impl RefUnwindSafe for AuditEvent
impl Send for AuditEvent
impl Sync for AuditEvent
impl Unpin for AuditEvent
impl UnsafeUnpin for AuditEvent
impl UnwindSafe for AuditEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more