Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currently Drupal core does not provide a Typed Data Logger Entry.
@see: dblog and syslog
But the Rules logger implementation: System log entry is created needs that.
Comments
Comment #2
ndf CreditAttribution: ndf commentedComment #3
klausiComment #4
ndf CreditAttribution: ndf commentedReading in on d8 TypedData: https://api.drupal.org/api/drupal/core!lib!Drupal!Core!TypedData!Plugin!...
The current array
Moving to
https://github.com/fago/rules/pull/315
Comment #5
klausiCool, left a couple of comments in the pull request.
Comment #6
ndf CreditAttribution: ndf commentedI am still in a doubt.
There are 3 ways I've been investigation and I cannot make a decision about how
logger_entry
should be handled:\Drupal\Core\TypedData\Plugin\DataType\Map
config/schema/rules.schema.yml
Notes:
approach new DataType
Extend
\Drupal\Core\TypedData\Plugin\DataType\Map
Doing
class LoggerEntry extends Map
with annotationdefinition_class = "\Drupal\rules\TypedData\LoggerEntryDataDefinition"
initiatingnew LoggerEntry()
gives a runtime-error that the definition must be passed to the LoggerEntry __constructor.This is probably just wrongly implemented by me.
Have been looking through a lot of core-examples of
extends Map()
and other TypedDate implementations. But I could not find one or more with this typical 'associative array with a couple of fixed keys and expected values' setup like logger_entry has.Via .yml
config/schema/rules.schema.yml
This method seems to be used for config-entities only. The definition (via .yml) looks very clear and simple though.
see below for the .yml I made up for now.
Make it an entity
Make it an entity with all the bells and whistles
Seems a fine approach, all though I could imagine it might have performance impact.
I am not sure if this means that all logger_entries now should be saved to the db or not.
But it could be an attractive approach because of a lot of integrations we get for free.
Example *.schema.yml for logger entry
Comment #7
klausiLeft a couple of comments in the pull request.
Yes, you will need a data definition class for the logger entry data type. It should not be an entity, since such a log entry cannot be saved. It is just data. The config schema shoould also not be necessary.
Comment #8
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedNote that the current Rules logger has a small bug: #2803823: Rules' logger needs to take care of its internal properties on serialization so we'll need to port that fix to this issue as well.
Comment #9
TR CreditAttribution: TR commented@ndf - this is still assigned to you. Are you going to work on it?
Comment #10
ndf CreditAttribution: ndf commented@TR nope, I unassigned myself
Comment #11
TR CreditAttribution: TR commentedAdded #1349882: Action: Create a watchdog entry as a related issue - that issue is for D7, but both that and this require exposing the watchdog log entry data structure to Rules. The data structure produced by the event should be the same as the data structure produced by the action.
Comment #12
TR CreditAttribution: TR commentedMoving this to the Typed Data API module, as that is where I think we should be putting generally-useful data type definitions.
Comment #13
TR CreditAttribution: TR commented