loggable.rst 1.6 KB

123456789101112131415161718192021222324252627282930
  1. Loggable
  2. ========
  3. Loggable is an interface inherited by any class that wants events relating to its member objects to be saved to the system log. ``ElggEntity`` and ``ElggExtender`` both inherit ``Loggable``.
  4. Loggable defines several class methods that are used in saving to the default system log, and can be used to define your own (as well as for other purposes):
  5. - ``getSystemLogID()`` Return a unique identifier for the object for storage in the system log. This is likely to be the object's GUID
  6. - ``getClassName()`` Return the class name of the object
  7. - ``getType()`` Return the object type
  8. - ``getSubtype()`` Get the object subtype
  9. - ``getObjectFromID($id)`` For a given ID, return the object associated with it
  10. - ``getObjectOwnerGUID()`` Return the GUID of the owner of this object
  11. Database details
  12. ----------------
  13. The default system log is stored in the ``system_log`` :doc:`database table <database>`. It contains the following fields:
  14. - **id** - A unique numeric row ID
  15. - **object_id** - The GUID of the entity being acted upon
  16. - **object_class** - The class of the entity being acted upon (eg ElggObject)
  17. - **object_type** - The type of the entity being acted upon (eg object)
  18. - **object_subtype** - The subtype of the entity being acted upon (eg blog)
  19. - **event** - The event being logged (eg create or update)
  20. - **performed_by_guid** - The GUID of the acting entity (the user performing the action)
  21. - **owner_guid** - The GUID of the user which owns the entity being acted upon
  22. - **access_id** - The access restriction associated with this log entry
  23. - **time_created** - The UNIX epoch timestamp of the time the event took place