From 92e7330180c1063f9f5a831507a65134e3d5e00b Mon Sep 17 00:00:00 2001 From: Dan Braghis Date: Thu, 16 Jul 2020 11:34:29 +0100 Subject: [PATCH] Update docs with current log actions and the rule of thumb for logging --- docs/advanced_topics/audit_log.rst | 40 +++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/docs/advanced_topics/audit_log.rst b/docs/advanced_topics/audit_log.rst index 4cdfa4fc95..6347c60ec0 100644 --- a/docs/advanced_topics/audit_log.rst +++ b/docs/advanced_topics/audit_log.rst @@ -3,7 +3,7 @@ Audit log ========= -Wagtail provides a mechanism to log actions performed on its objects. Common activities like page creation, update, deletion, +Wagtail provides a mechanism to log actions performed on its objects. Common activities such as page creation, update, deletion, locking and unlocking, revision scheduling and privacy changes are automatically logged at the model level. The Wagtail admin uses the action log entries to provide a site-wide and page specific history of changes. It uses a @@ -17,6 +17,10 @@ To provide additional ``Page`` logging for your site or package, invoke the :met via ``PageLogEntry.objects.log_action(object_instance, action)`` and register a ``register_log_actions`` hook to describe your action (see :ref:`register_log_actions`). +.. note:: When adding logging, you need to log the action or actions that happen to the ``Page``. For example, if the + user creates and publishes, there should be a "create" entry and a "publish" entry. Or, if the user copies a + published page and chooses to keep it published, there should be a "copy" and a "publish" entry for new page. + You can provide additional metadata by passing additional parameters: - ``user`` - a user object. @@ -44,3 +48,37 @@ You can provide additional metadata by passing additional parameters: To log actions for your non-page model, you can create a class that inherits from ``BaseLogEntry`` with the appropriate linking. + +Log actions provided by Wagtail +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +=================================== ===== +Action Notes +=================================== ===== +``wagtail.create`` The page was created +``wagtail.edit`` A draft was saved +``wagtail.delete`` The page was deleted. Will only surface in the Site History for administrators +``wagtail.publish`` The page was published +``wagtail.publish.schedule`` Draft is scheduled for publishing +``wagtail.publish.scheduled`` Draft published via ``publish_scheduled_pages`` management command +``wagtail.schedule.cancel`` Draft scheduled for publishing cancelled via "Cancel scheduled publish" +``wagtail.unpublish`` The page was unpublished +``wagtail.unpublish.scheduled`` Page unpublished via ``publish_scheduled_pages`` management command +``wagtail.lock`` Page was locked +``wagtail.unlock`` Page was unlocked +``wagtail.moderation.approve`` The revision was approved for moderation +``wagtail.moderation.reject`` The revision was rejected +``wagtail.rename`` A page was renamed +``wagtail.revert`` The page was reverted to a previous draft +``wagtail.copy`` The page was copied to a new location +``wagtail.move`` The page was moved to a new location +``wagtail.view_restriction.create`` The page was restricted +``wagtail.view_restriction.edit`` The page restrictions were updated +``wagtail.view_restriction.delete`` The page restrictions were removed + +``wagtail.workflow.start`` The page was submitted for moderation in a Workflow +``wagtail.workflow.approve`` The draft was approved at a Workflow Task +``wagtail.workflow.reject`` The draft was rejected, and changes requested at a Workflow Task +``wagtail.workflow.resume`` The draft was resubmitted to the workflow +``wagtail.workflow.cancel`` The workflow was cancelled +=================================== =====