update for version 1.0.2

This commit is contained in:
sujitprasad
2015-11-30 16:38:59 +05:30
parent d0a69a8df1
commit 7e17edab1e
425 changed files with 14241 additions and 3410 deletions

View File

@@ -1,3 +1,10 @@
### 1.17.2 (2015-10-14)
* Fixed ErrorHandler compatibility with non-Monolog PSR-3 loggers
* Fixed SlackHandler handling to use slack functionalities better
* Fixed SwiftMailerHandler bug when sending multiple emails they all had the same id
* Fixed 5.3 compatibility regression
### 1.17.1 (2015-08-31)
* Fixed RollbarHandler triggering PHP notices

View File

@@ -19,14 +19,15 @@
"require-dev": {
"phpunit/phpunit": "~4.5",
"graylog2/gelf-php": "~1.0",
"raven/raven": "~0.11",
"raven/raven": "^0.13",
"ruflin/elastica": ">=0.90 <3.0",
"doctrine/couchdb": "~1.0@dev",
"aws/aws-sdk-php": "^2.4.9",
"videlalvaro/php-amqplib": "~2.4",
"swiftmailer/swiftmailer": "~5.3",
"php-console/php-console": "^3.1.3",
"phpunit/phpunit-mock-objects": "2.3.0"
"phpunit/phpunit-mock-objects": "2.3.0",
"jakub-onderka/php-parallel-lint": "0.9"
},
"_": "phpunit/phpunit-mock-objects required in 2.3.0 due to https://github.com/sebastianbergmann/phpunit-mock-objects/issues/223 - needs hhvm 3.8+ on travis",
"suggest": {
@@ -56,6 +57,9 @@
}
},
"scripts": {
"test": "phpunit"
"test": [
"parallel-lint . --exclude vendor",
"phpunit"
]
}
}

View File

@@ -174,9 +174,11 @@ class ErrorHandler
array('code' => $lastError['type'], 'message' => $lastError['message'], 'file' => $lastError['file'], 'line' => $lastError['line'])
);
foreach ($this->logger->getHandlers() as $handler) {
if ($handler instanceof AbstractHandler) {
$handler->close();
if ($this->logger instanceof Logger) {
foreach ($this->logger->getHandlers() as $handler) {
if ($handler instanceof AbstractHandler) {
$handler->close();
}
}
}
}

View File

@@ -33,13 +33,11 @@ class Util
{
while ($retries--) {
if (curl_exec($ch) === false) {
$curlErrno = curl_errno($ch);
if (false === in_array($curlErrno, self::$retriableErrorCodes, true) || !$retries) {
$curlError = curl_error($ch);
if ($closeAfterDone) {
curl_close($ch);
}

View File

@@ -20,8 +20,8 @@ use Monolog\Logger;
*/
class MandrillHandler extends MailHandler
{
protected $client;
protected $message;
protected $apiKey;
/**
* @param string $apiKey A valid Mandrill API key

View File

@@ -58,7 +58,7 @@ class RollbarHandler extends AbstractProcessingHandler
$exception = $context['exception'];
unset($context['exception']);
$payload = [];
$payload = array();
if (isset($context['payload'])) {
$payload = $context['payload'];
unset($context['payload']);

View File

@@ -145,29 +145,20 @@ class SlackHandler extends SocketHandler
if ($this->useAttachment) {
$attachment = array(
'fallback' => $record['message'],
'color' => $this->getAttachmentColor($record['level'])
'color' => $this->getAttachmentColor($record['level']),
'fields' => array()
);
if ($this->useShortAttachment) {
$attachment['fields'] = array(
array(
'title' => $record['level_name'],
'value' => $record['message'],
'short' => false
)
);
$attachment['title'] = $record['level_name'];
$attachment['text'] = $record['message'];
} else {
$attachment['fields'] = array(
array(
'title' => 'Message',
'value' => $record['message'],
'short' => false
),
array(
'title' => 'Level',
'value' => $record['level_name'],
'short' => true
)
$attachment['title'] = 'Message';
$attachment['text'] = $record['message'];
$attachment['fields'][] = array(
'title' => 'Level',
'value' => $record['level_name'],
'short' => true
);
}

View File

@@ -57,6 +57,7 @@ class SwiftMailerHandler extends MailHandler
$message = null;
if ($this->messageTemplate instanceof \Swift_Message) {
$message = clone $this->messageTemplate;
$message->generateId();
} elseif (is_callable($this->messageTemplate)) {
$message = call_user_func($this->messageTemplate, $content, $records);
}

View File

@@ -15,6 +15,10 @@ class UdpSocket
{
const DATAGRAM_MAX_LENGTH = 65023;
protected $ip;
protected $port;
protected $socket;
public function __construct($ip, $port = 514)
{
$this->ip = $ip;

View File

@@ -21,6 +21,8 @@ use Monolog\Handler\SyslogUdp\UdpSocket;
*/
class SyslogUdpHandler extends AbstractSyslogHandler
{
protected $socket;
/**
* @param string $host
* @param int $port

View File

@@ -91,7 +91,7 @@ class IntrospectionProcessor
return $record;
}
private function isTraceClassOrSkippedFunction (array $trace, $index)
private function isTraceClassOrSkippedFunction(array $trace, $index)
{
if (!isset($trace[$index])) {
return false;

View File

@@ -3,6 +3,8 @@ namespace Monolog\Formatter;
class ScalarFormatterTest extends \PHPUnit_Framework_TestCase
{
private $formatter;
public function setUp()
{
$this->formatter = new ScalarFormatter();

View File

@@ -15,6 +15,8 @@ use Monolog\TestCase;
class DynamoDbHandlerTest extends TestCase
{
private $client;
public function setUp()
{
if (!class_exists('Aws\DynamoDb\DynamoDbClient')) {

View File

@@ -233,12 +233,12 @@ class HipChatHandlerTest extends TestCase
*/
public function testCreateWithTooLongName()
{
$hipChatHandler = new \Monolog\Handler\HipChatHandler('token', 'room', 'SixteenCharsHere');
$hipChatHandler = new HipChatHandler('token', 'room', 'SixteenCharsHere');
}
public function testCreateWithTooLongNameV2()
{
// creating a handler with too long of a name but using the v2 api doesn't matter.
$hipChatHandler = new \Monolog\Handler\HipChatHandler('token', 'room', 'SixteenCharsHere', false, Logger::CRITICAL, true, true, 'test', 'api.hipchat.com', 'v2');
$hipChatHandler = new HipChatHandler('token', 'room', 'SixteenCharsHere', false, Logger::CRITICAL, true, true, 'test', 'api.hipchat.com', 'v2');
}
}

View File

@@ -117,7 +117,7 @@ class RavenHandlerTest extends TestCase
$ravenClient->user_context(array('id' => 'test_user_id'));
// handle context
$handler->handle($recordWithContext);
$this->assertEquals($user, $ravenClient->lastData['sentry.interfaces.User']);
$this->assertEquals($user, $ravenClient->lastData['user']);
// check to see if its reset
$handler->handle($recordWithNoContext);
@@ -127,7 +127,7 @@ class RavenHandlerTest extends TestCase
// handle with null context
$ravenClient->user_context(null);
$handler->handle($recordWithContext);
$this->assertEquals($user, $ravenClient->lastData['sentry.interfaces.User']);
$this->assertEquals($user, $ravenClient->lastData['user']);
// check to see if its reset
$handler->handle($recordWithNoContext);

View File

@@ -62,4 +62,18 @@ class SwiftMailerHandlerTest extends TestCase
);
$handler->handleBatch($records);
}
public function testMessageHaveUniqueId() {
$messageTemplate = \Swift_Message::newInstance();
$handler = new SwiftMailerHandler($this->mailer, $messageTemplate);
$method = new \ReflectionMethod('Monolog\Handler\SwiftMailerHandler', 'buildMessage');
$method->setAccessible(true);
$method->invokeArgs($handler, array($messageTemplate, array()));
$builtMessage1 = $method->invoke($handler, $messageTemplate, array());
$builtMessage2 = $method->invoke($handler, $messageTemplate, array());
$this->assertFalse($builtMessage1->getId() === $builtMessage2->getId(), 'Two different messages have the same id');
}
}

View File

@@ -130,7 +130,6 @@ class RegistryTest extends \PHPUnit_Framework_TestCase
$log1 = new Logger('test1');
$log2 = new Logger('test2');
Registry::addLogger($log1, 'log');
Registry::addLogger($log2, 'log', true);