mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-08 14:16:42 +02:00
Remove variable func call and some more curl error checks
This commit is contained in:
@@ -116,7 +116,11 @@ class CubeHandler extends AbstractProcessingHandler
|
||||
$data['data'] = $record['context'];
|
||||
$data['data']['level'] = $record['level'];
|
||||
|
||||
$this->{'write'.$this->scheme}(json_encode($data));
|
||||
if ($this->scheme === 'http') {
|
||||
$this->writeHttp(json_encode($data));
|
||||
} else {
|
||||
$this->writeUdp(json_encode($data));
|
||||
}
|
||||
}
|
||||
|
||||
private function writeUdp($data)
|
||||
@@ -140,6 +144,8 @@ class CubeHandler extends AbstractProcessingHandler
|
||||
'Content-Length: ' . strlen('['.$data.']'))
|
||||
);
|
||||
|
||||
return curl_exec($this->httpConnection);
|
||||
if (curl_exec($this->httpConnection) === false) {
|
||||
throw new \RuntimeException(sprintf('Curl error (code %s): %s', curl_errno($ch), curl_error($ch)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -63,7 +63,9 @@ class MandrillHandler extends MailHandler
|
||||
'async' => false,
|
||||
)));
|
||||
|
||||
curl_exec($ch);
|
||||
if (curl_exec($ch) === false) {
|
||||
throw new \RuntimeException(sprintf('Curl error (code %s): %s', curl_errno($ch), curl_error($ch)));
|
||||
}
|
||||
curl_close($ch);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user