AshEventLog.EventLog

Copy Markdown View Source

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

NameTypeDefaultDocs
primary_key_type:uuid | :uuid_v7 | :integer:uuid_v7The type of the event's primary key.
record_id_type:uuid | :uuid_v7 | :integer | :string:uuidThe 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_keyslist(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

NameTypeDefaultDocs
nameatomThe attribute name for storing the actor's primary key (e.g. :user_id)
destinationatomThe actor resource module (e.g. MyApp.Accounts.User)

Options

NameTypeDefaultDocs
attribute_typeany:uuidThe Ash type of the actor's primary key. Defaults to :uuid.
allow_nil?booleantrueWhether this field can be nil.