logs_http.module in Logs HTTP 8
Same filename and directory in other branches
Logs HTTP module.
File
logs_http.moduleView source
<?php
/**
* @file
* Logs HTTP module.
*/
use GuzzleHttp\Exception\RequestException;
/**
* Runs on shutdown to clean up and display developer information.
*
* @see \Drupal\logs_http\EventSubscriber\LogsHttpEventSubscriber
*/
function logs_http_shutdown() {
/** @var \Drupal\logs_http\Logger\LogsHttpLogger $logs_http_logger */
$logs_http_logger = \Drupal::service('logs_http.logs_http_logger');
if (!$logs_http_logger
->isEnabled()) {
return;
}
if (!($events = $logs_http_logger
->getEvents())) {
return;
}
$url = $logs_http_logger
->getUrl();
// Send events to logs.
foreach ($events as $event) {
$client = \Drupal::httpClient();
try {
// Send data to Logs.
$client
->post($url, [
'json' => $event,
'headers' => $logs_http_logger
->getHttpHeaders(),
]);
} catch (RequestException $e) {
}
}
}
Functions
Name | Description |
---|---|
logs_http_shutdown | Runs on shutdown to clean up and display developer information. |