1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-22 17:16:18 +02:00

Merge branch '1.x'

This commit is contained in:
Jordi Boggiano
2017-06-19 02:16:33 +02:00
11 changed files with 66 additions and 27 deletions

View File

@@ -37,7 +37,7 @@ class ChromePHPHandler extends AbstractProcessingHandler
/**
* Regular expression to detect supported browsers (matches any Chrome, or Firefox 43+)
*/
const USER_AGENT_REGEX = '{\b(?:Chrome/\d+(?:\.\d+)*|Firefox/(?:4[3-9]|[5-9]\d|\d{3,})(?:\.\d)*)\b}';
const USER_AGENT_REGEX = '{\b(?:Chrome/\d+(?:\.\d+)*|HeadlessChrome|Firefox/(?:4[3-9]|[5-9]\d|\d{3,})(?:\.\d)*)\b}';
protected static $initialized = false;

View File

@@ -11,7 +11,7 @@
namespace Monolog\Handler;
use Aws\Common\Aws;
use Aws\Sdk;
use Aws\DynamoDb\DynamoDbClient;
use Monolog\Formatter\FormatterInterface;
use Aws\DynamoDb\Marshaler;
@@ -56,7 +56,7 @@ class DynamoDbHandler extends AbstractProcessingHandler
*/
public function __construct(DynamoDbClient $client, $table, $level = Logger::DEBUG, $bubble = true)
{
if (defined('Aws\Common\Aws::VERSION') && version_compare(Aws::VERSION, '3.0', '>=')) {
if (defined('Aws\Sdk::VERSION') && version_compare(Sdk::VERSION, '3.0', '>=')) {
$this->version = 3;
$this->marshaler = new Marshaler;
} else {

View File

@@ -16,15 +16,17 @@ use Monolog\Formatter\FormatterInterface;
/**
* This simple wrapper class can be used to extend handlers functionality.
*
* Example: A filtering handle. Inherit from this class, override isHandling() like this
* Example: A custom filtering that can be applied to any handler.
*
* public function isHandling(array $record)
* {
* if ($record meets certain conditions) {
* return false;
* }
* return $this->handler->isHandling($record);
* }
* Inherit from this class and override handle() like this:
*
* public function handle(array $record)
* {
* if ($record meets certain conditions) {
* return false;
* }
* return $this->handler->handle($record);
* }
*
* @author Alexey Karapetov <alexey@karapetov.com>
*/

View File

@@ -81,13 +81,18 @@ class SlackWebhookHandler extends AbstractProcessingHandler
$postString = json_encode($postData);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->webhookUrl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$options = [
CURLOPT_URL => $this->webhookUrl,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Content-type: application/json'],
CURLOPT_POSTFIELDS => $postString
];
if (defined('CURLOPT_SAFE_UPLOAD')) {
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
$options[CURLOPT_SAFE_UPLOAD] = true;
}
curl_setopt($ch, CURLOPT_POSTFIELDS, array('payload' => $postString));
curl_setopt_array($ch, $options);
Curl\Util::execute($ch);
}

View File

@@ -14,6 +14,7 @@ namespace Monolog\Handler;
use Monolog\Logger;
use Monolog\Formatter\LineFormatter;
use Swift_Message;
use Swift;
/**
* SwiftMailerHandler uses Swift_Mailer to send the emails
@@ -79,7 +80,11 @@ class SwiftMailerHandler extends MailHandler
}
$message->setBody($content, $mime);
$message->setDate(time());
if (version_compare(Swift::VERSION, '6.0.0', '>=')) {
$message->setDate(new \DateTimeImmutable());
} else {
$message->setDate(time());
}
return $message;
}