1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-07-30 09:50:26 +02:00

Merge pull request #1573 from mimmi20/add-extension-checks

add checks for required curl extension
This commit is contained in:
Jordi Boggiano
2021-09-14 15:25:08 +02:00
committed by GitHub
4 changed files with 16 additions and 0 deletions

View File

@@ -38,6 +38,10 @@ class IFTTTHandler extends AbstractProcessingHandler
*/
public function __construct(string $eventName, string $secretKey, $level = Logger::ERROR, bool $bubble = true)
{
if (!extension_loaded('curl')) {
throw new MissingExtensionException('The curl extension is needed to use the IFTTTHandler');
}
$this->eventName = $eventName;
$this->secretKey = $secretKey;

View File

@@ -59,6 +59,10 @@ class SendGridHandler extends MailHandler
*/
public function __construct(string $apiUser, string $apiKey, string $from, $to, string $subject, $level = Logger::ERROR, bool $bubble = true)
{
if (!extension_loaded('curl')) {
throw new MissingExtensionException('The curl extension is needed to use the SendGridHandler');
}
parent::__construct($level, $bubble);
$this->apiUser = $apiUser;
$this->apiKey = $apiKey;

View File

@@ -58,6 +58,10 @@ class SlackWebhookHandler extends AbstractProcessingHandler
bool $bubble = true,
array $excludeFields = array()
) {
if (!extension_loaded('curl')) {
throw new MissingExtensionException('The curl extension is needed to use the SlackWebhookHandler');
}
parent::__construct($level, $bubble);
$this->webhookUrl = $webhookUrl;

View File

@@ -90,6 +90,10 @@ class TelegramBotHandler extends AbstractProcessingHandler
bool $disableWebPagePreview = null,
bool $disableNotification = null
) {
if (!extension_loaded('curl')) {
throw new MissingExtensionException('The curl extension is needed to use the TelegramBotHandler');
}
parent::__construct($level, $bubble);
$this->apiKey = $apiKey;