Extension for the centralized event log resource.
Generates attributes, actions, and optionally actor fields.
use Ash.Resource,
extensions: [AshEventLog.EventLog]
event_log do
persist_actor_primary_key :user_id, MyApp.Accounts.User
public_fields :all
end
event_log
Nested DSLs
Options
| Name | Type | Default | Docs |
|---|
primary_key_type | :uuid | :uuid_v7 | :integer | :uuid_v7 | The type of the event's primary key. |
record_id_type | :uuid | :uuid_v7 | :integer | :string | :uuid | The type of the tracked resources' primary keys. |
public_fields | :all | list(atom) | [] | Which fields to make public. :all or a list of field names. |
logger_metadata_keys | list(atom) | [:request_id] | Logger metadata keys to auto-capture into event metadata. Use [:*] to capture all. |
event_log.persist_actor_primary_key
persist_actor_primary_key name, destination
Arguments
| Name | Type | Default | Docs |
|---|
name | atom | | The attribute name for storing the actor's primary key (e.g. :user_id) |
destination | atom | | The actor resource module (e.g. MyApp.Accounts.User) |
Options
| Name | Type | Default | Docs |
|---|
attribute_type | any | :uuid | The Ash type of the actor's primary key. Defaults to :uuid. |
allow_nil? | boolean | true | Whether this field can be nil. |