From 08509558347ac3dceafcb05889a56234326ec1dc Mon Sep 17 00:00:00 2001 From: Radoslav Terezka Date: Thu, 1 Feb 2018 07:55:43 +0100 Subject: [PATCH 1/2] allow to alter/extend the event data --- logs_http.api.php | 19 +++++++++++++++++++ logs_http.module | 4 ++++ 2 files changed, 23 insertions(+) create mode 100644 logs_http.api.php diff --git a/logs_http.api.php b/logs_http.api.php new file mode 100644 index 0000000..892c13e --- /dev/null +++ b/logs_http.api.php @@ -0,0 +1,19 @@ +alter('logs_http_event', $event); + $client = \Drupal::httpClient(); try { From 58db512502e5d00d26d00c37ac1b05f94d066f70 Mon Sep 17 00:00:00 2001 From: Radoslav Terezka Date: Thu, 1 Feb 2018 07:57:04 +0100 Subject: [PATCH 2/2] allow to completely disable sending the events to the log service --- logs_http.module | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/logs_http.module b/logs_http.module index eb124db..3b08c9e 100644 --- a/logs_http.module +++ b/logs_http.module @@ -82,10 +82,18 @@ function logs_http_shutdown() { // Send events to logs. foreach ($events as $event) { - // Allows to alter an event by adding new properties. + // 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 {