Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions logs_http.api.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/**
* @file
* Documents API functions for logs_http module.
*/

/**
* Alter the event which is going to be sent to the log service.
*
* Additionally you can stop sending an event to the log service by setting
* $event['send'] to FALSE. Useful for local environments, where this
* feature needs to be disabled.
*/
function hook_logs_http_event_alter(&$event) {
if (Settings::get('environment') == 'local') {
$event['send'] = FALSE;
}
}
12 changes: 12 additions & 0 deletions logs_http.module
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ function logs_http_shutdown() {

// Send events to logs.
foreach ($events as $event) {
// Allows to alter an event by adding new properties, or completely disable
// sending an event to the log service by setting $event['send'] = FALSE;
$event['send'] = TRUE;
$module_handler = \Drupal::moduleHandler();
$module_handler->alter('logs_http_event', $event);

// If event does not want be sent, continue with the next one.
if (empty($event['send'])) {
continue;
}

unset($event['send']);
$client = \Drupal::httpClient();

try {
Expand Down