mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-06 05:07:36 +02:00
Merge pull request #661 from pomaxa/isset
fix CubeHandler http connection and few small updates
This commit is contained in:
@@ -41,10 +41,9 @@ class ChromePHPFormatter implements FormatterInterface
|
|||||||
{
|
{
|
||||||
// Retrieve the line and file if set and remove them from the formatted extra
|
// Retrieve the line and file if set and remove them from the formatted extra
|
||||||
$backtrace = 'unknown';
|
$backtrace = 'unknown';
|
||||||
if (isset($record['extra']['file']) && isset($record['extra']['line'])) {
|
if (isset($record['extra']['file'], $record['extra']['line'])) {
|
||||||
$backtrace = $record['extra']['file'].' : '.$record['extra']['line'];
|
$backtrace = $record['extra']['file'].' : '.$record['extra']['line'];
|
||||||
unset($record['extra']['file']);
|
unset($record['extra']['file'], $record['extra']['line']);
|
||||||
unset($record['extra']['line']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = array('message' => $record['message']);
|
$message = array('message' => $record['message']);
|
||||||
|
@@ -21,11 +21,11 @@ use Monolog\Logger;
|
|||||||
*/
|
*/
|
||||||
class CubeHandler extends AbstractProcessingHandler
|
class CubeHandler extends AbstractProcessingHandler
|
||||||
{
|
{
|
||||||
private $udpConnection = null;
|
private $udpConnection;
|
||||||
private $httpConnection = null;
|
private $httpConnection;
|
||||||
private $scheme = null;
|
private $scheme;
|
||||||
private $host = null;
|
private $host;
|
||||||
private $port = null;
|
private $port;
|
||||||
private $acceptedSchemes = array('http', 'udp');
|
private $acceptedSchemes = array('http', 'udp');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,7 +39,7 @@ class CubeHandler extends AbstractProcessingHandler
|
|||||||
{
|
{
|
||||||
$urlInfos = parse_url($url);
|
$urlInfos = parse_url($url);
|
||||||
|
|
||||||
if (!isset($urlInfos['scheme']) || !isset($urlInfos['host']) || !isset($urlInfos['port'])) {
|
if (!isset($urlInfos['scheme'], $urlInfos['host'], $urlInfos['port'])) {
|
||||||
throw new \UnexpectedValueException('URL "'.$url.'" is not valid');
|
throw new \UnexpectedValueException('URL "'.$url.'" is not valid');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,6 +60,7 @@ class CubeHandler extends AbstractProcessingHandler
|
|||||||
* Establish a connection to an UDP socket
|
* Establish a connection to an UDP socket
|
||||||
*
|
*
|
||||||
* @throws \LogicException when unable to connect to the socket
|
* @throws \LogicException when unable to connect to the socket
|
||||||
|
* @throws MissingExtensionException when there is no socket extension
|
||||||
*/
|
*/
|
||||||
protected function connectUdp()
|
protected function connectUdp()
|
||||||
{
|
{
|
||||||
@@ -79,6 +80,7 @@ class CubeHandler extends AbstractProcessingHandler
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Establish a connection to a http server
|
* Establish a connection to a http server
|
||||||
|
* @throws \LogicException when no curl extension
|
||||||
*/
|
*/
|
||||||
protected function connectHttp()
|
protected function connectHttp()
|
||||||
{
|
{
|
||||||
@@ -144,6 +146,6 @@ class CubeHandler extends AbstractProcessingHandler
|
|||||||
'Content-Length: ' . strlen('['.$data.']'))
|
'Content-Length: ' . strlen('['.$data.']'))
|
||||||
);
|
);
|
||||||
|
|
||||||
Curl\Util::execute($ch, 5, false);
|
Curl\Util::execute($this->httpConnection, 5, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -79,6 +79,7 @@ class SlackHandler extends SocketHandler
|
|||||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||||
* @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style
|
* @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style
|
||||||
* @param bool $includeContextAndExtra Whether the attachment should include context and extra data
|
* @param bool $includeContextAndExtra Whether the attachment should include context and extra data
|
||||||
|
* @throws MissingExtensionException If no OpenSSL PHP extension configured
|
||||||
*/
|
*/
|
||||||
public function __construct($token, $channel, $username = 'Monolog', $useAttachment = true, $iconEmoji = null, $level = Logger::CRITICAL, $bubble = true, $useShortAttachment = false, $includeContextAndExtra = false)
|
public function __construct($token, $channel, $username = 'Monolog', $useAttachment = true, $iconEmoji = null, $level = Logger::CRITICAL, $bubble = true, $useShortAttachment = false, $includeContextAndExtra = false)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user