From the meta, this task needs to:
Create a logger (not logger channel) analogous to DbLog which will be used to store Rules debug logs in a data structure. This will be the replacement for the D7 RulesLog class.
I decided to call this "RulesDebugLog". I am exposing it as a service so it is a singleton - all logs then go to the same class instance, and all logs can be retrieved from the service when needed. (This is very similar to how "RulesLog" worked in D7.)
The main constraint is that the debug log data needs to persist across page loads. This is because a Rule may not have executed at the point the page is rendered, so if we want to display the debug log of that Rule's execution it will have to be on the next page. For example, if your Rule fires on "After new content has been created" then that Rule will fire when you press the "Save" button on the node/add/<type> page. So the output of the debug log wasn't available when that page was rendered, and won't be available until the next page after the form is submitted.
The attached patch uses the session service to store debug logs temporarily. I also tried this using a private tempstore, but the tempstore solution seems to be a factor of 10 slower based on trying it several dozen times with a set of example Rules.
This patch doesn't change any Rules behavior yet, it is just an intermediate step - we need a place to store the logs first, then we can actually store them and render them once we have this service.
| Comment | File | Size | Author |
|---|---|---|---|
| rules-debug-log.patch | 3.2 KB | tr |
Comments
Comment #2
tr commentedComment #4
tr commentedCommitted.