Events
Sometimes you want to store events and other ad hoc data to refer to later and drive application behaviour, or to store logging information.
Forme includes a basic solution for this.
The Event Model
An event has he following data structure:
- Type - a snake case string representing the type of event, for example
log
oruser_action
- Payload - a json object containing the event payload, for example the log report, or details of the user action that occurred
- Created at - the time the event happened
php
Event::create(['type' => 'log', 'payload' => ['foobar' => 'something happened']]);
It should in theory be immutable - that is once it's been created, it should never be modified or deleted.
Application Logging
By default, Forme stores its own logs as Events when WP_ENV
is set to production
.