1
0
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:
Jordi Boggiano
2015-06-19 14:29:43 +01:00
parent 0c3d2082ad
commit 4e53428476
2 changed files with 11 additions and 3 deletions

View File

@@ -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)));
}
}
}

View File

@@ -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);
}
}