log()

Overview

public void function log(
      required string userId  
    , required string action  
    , required string type    
    ,          string recordId = ""
    ,          any    detail  
)

Inserts a log entry into the system's audit log. You are most likely to want to use either $audit() or event.audit() to proxy to this method (see Using the audit trail system for more details).

Arguments

NameTypeRequiredDescription
userIdstringYesID of the admin user who performed the action
actionstringYesKey of the action performed, e.g. datamanager_edit_record
typestringYesType of action performed, used for grouping audit logs, e.g. datamanager
recordIdstringNo (default="")ID of the entity that was acted upon. For example, the ID of a record that was edited
detailanyNoA struct containing data that will be useful when rendering the audit log entry. For example, a list of fields that were changed in an edit process