Skip to content

Commit

Permalink
Format list of events executed during presave
Browse files Browse the repository at this point in the history
If benchmark is enabled of course
  • Loading branch information
DiegoPino committed Jul 8, 2020
1 parent 98923d4 commit 63d3835
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions strawberryfield.module
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,16 @@ function strawberryfield_node_presave(ContentEntityInterface $entity) {
$events = '';
foreach($event->getProcessedBy() as $event_info) {
$success = $event_info['success']? 'Successful' : 'Failure';
$events .= $event_info['class'].'=>'.$success.'\n\r>';
$events .= '<li>'.$event_info['class']. ' => '.$success.'</li>';
}
$events_markup = \Drupal\Core\Render\Markup::create($events);
\Drupal::logger('strawberryfield')->notice(
'ADO with UUID @uuid spent @time seconds on all presave event subscriber processing and max memory usage was @maxmem. Event Subscribers that run where the following <br> @events',
'ADO with UUID @uuid spent @time seconds on all presave event subscriber processing and max memory usage was @maxmem. <br> Event Subscribers that could run were the following: <br><ul>@events</ul>',
[
'@uuid' => $entity->uuid(),
'@time' => $time,
'@maxmem' => \Drupal::service('strawberryfield.utility')->formatBytes($max_memory, 2),
'@events' => $events,
'@events' => $events_markup,
]
);
}
Expand Down

0 comments on commit 63d3835

Please sign in to comment.