Comments

ndf created an issue. See original summary.

ndf’s picture

@see
hook_watchdog() and watchdog() removed
https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func...

d7 implementation: http://cgit.drupalcode.org/rules/tree/modules/events.inc

/**
 * Implements hook_watchdog().
 */
function rules_watchdog($log_entry) {
  rules_invoke_event('watchdog', $log_entry);
}
ndf’s picture

Status: Active » Needs review
klausi’s picture

Status: Needs review » Needs work

I looked at core and could not find a typed data structure for log entries. I think we should invent one in Rules, which is far from ideal but we need the context data of what is in a watchdog entry to pass along with the event.

I'm thinking of:

class LogData extends TypedData implements \IteratorAggregate, ComplexDataInterface

You can look at EntityAdapter for example what you need to implement.

ndf’s picture

Talked with Klausi, Xano and Fago.

The new TypedData "Logger Entry" can be developed separately in this ticket: https://www.drupal.org/node/2625238

For now we use context-type "Any" instead.

ndf’s picture

Status: Needs work » Needs review

PR: https://github.com/fago/rules/pull/297

added todos referencing to task https://www.drupal.org/node/2625238
added context 'logger_entry' of type 'any'
added an integration-metadata-test that test if $event->logger_entry is of type 'any'

klausi’s picture

Status: Needs review » Needs work

left a couple of minor comments in the pull request.

ndf’s picture

Status: Needs work » Needs review

Hi klausi,
Just fixed your comments.
https://github.com/fago/rules/pull/297

klausi’s picture

Status: Needs review » Needs work

The branch has conflicts, can you merge in 8.x-3.x?

ndf’s picture

Status: Needs work » Needs review

New PR https://github.com/fago/rules/pull/314

replaces https://github.com/fago/rules/pull/297/files

Not sure why the merge/rebase failed. So opened a new branch and copy-pasted changes there.

klausi’s picture

Status: Needs review » Needs work

just a missing category on the event, otherwise looks good!

ndf’s picture

Status: Needs work » Needs review

Nice, than this one should be the final PR:
https://github.com/fago/rules/pull/314

  • klausi committed 3a9df9b on 8.x-3.x authored by ndf
    Issue #2624848: Port event "System watchdog log entry is created" to D8
    
klausi’s picture

Status: Needs review » Fixed

merged, thanks!

Let's continue in #2625238: Create Typed Data "Logger Entry" type

ndf’s picture

Cool!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.