In order to log simple configuration changes like a site-name change, contributed modules like contrib_log work fine.

It just diffs the changes files in active configuration and logs it.

But when you change a field definition or delete(!) a content type, the logs are not so descriptive and we get a whole lot of .yml files changes log, not really describing what happened. We only see all the .yml files changed and their diff, and that doesn't have much value. I mean there is naturally no log line saying : "New field added." or "Language French removed".

I understand why it is like that, but I'm looking for a way to add value to these logs.

I've looked into Drupal\Core\Config\ConfigEvents and trying to figure out if there is a way to know when we are changing a content type or a language for example and log this change in a sensible way, without logging a set of unreadable .yml file diffs?

Thank you

  • 1
    To log on a higher level you could use CRUD events for non simple configuration items (config entities) being created, updated or deleted, see api.drupal.org/api/drupal/… – 4k4 Oct 21 '19 at 12:52
  • Yeah I've been playing around with Drupal\Core\Entity\EntityTypeEvents and Drupal\Core\Field\FieldStorageDefinitionEvents, trying to achieve it without the entity hooks, thanks – Pan Chrono Oct 22 '19 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.