mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-07 05:36:45 +02:00
Merge branch '1.x'
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
"sentry/sentry": "^0.13",
|
"sentry/sentry": "^0.13",
|
||||||
"ruflin/elastica": ">=0.90 <3.0",
|
"ruflin/elastica": ">=0.90 <3.0",
|
||||||
"doctrine/couchdb": "~1.0@dev",
|
"doctrine/couchdb": "~1.0@dev",
|
||||||
"aws/aws-sdk-php": "^2.4.9",
|
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
|
||||||
"php-amqplib/php-amqplib": "~2.4",
|
"php-amqplib/php-amqplib": "~2.4",
|
||||||
"swiftmailer/swiftmailer": "~5.3",
|
"swiftmailer/swiftmailer": "~5.3",
|
||||||
"php-console/php-console": "^3.1.3",
|
"php-console/php-console": "^3.1.3",
|
||||||
|
@@ -14,6 +14,7 @@ namespace Monolog\Handler;
|
|||||||
use Aws\Common\Aws;
|
use Aws\Common\Aws;
|
||||||
use Aws\DynamoDb\DynamoDbClient;
|
use Aws\DynamoDb\DynamoDbClient;
|
||||||
use Monolog\Formatter\FormatterInterface;
|
use Monolog\Formatter\FormatterInterface;
|
||||||
|
use Aws\DynamoDb\Marshaler;
|
||||||
use Monolog\Formatter\ScalarFormatter;
|
use Monolog\Formatter\ScalarFormatter;
|
||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
|
|
||||||
@@ -37,6 +38,16 @@ class DynamoDbHandler extends AbstractProcessingHandler
|
|||||||
*/
|
*/
|
||||||
protected $table;
|
protected $table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Marshaler
|
||||||
|
*/
|
||||||
|
protected $marshaler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param DynamoDbClient $client
|
* @param DynamoDbClient $client
|
||||||
* @param string $table
|
* @param string $table
|
||||||
@@ -45,8 +56,11 @@ class DynamoDbHandler extends AbstractProcessingHandler
|
|||||||
*/
|
*/
|
||||||
public function __construct(DynamoDbClient $client, $table, $level = Logger::DEBUG, $bubble = true)
|
public function __construct(DynamoDbClient $client, $table, $level = Logger::DEBUG, $bubble = true)
|
||||||
{
|
{
|
||||||
if (!defined('Aws\Common\Aws::VERSION') || version_compare('3.0', Aws::VERSION, '<=')) {
|
if (defined('Aws\Common\Aws::VERSION') && version_compare(Aws::VERSION, '3.0', '>=')) {
|
||||||
throw new \RuntimeException('The DynamoDbHandler is only known to work with the AWS SDK 2.x releases');
|
$this->version = 3;
|
||||||
|
$this->marshaler = new Marshaler;
|
||||||
|
} else {
|
||||||
|
$this->version = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->client = $client;
|
$this->client = $client;
|
||||||
@@ -61,7 +75,11 @@ class DynamoDbHandler extends AbstractProcessingHandler
|
|||||||
protected function write(array $record)
|
protected function write(array $record)
|
||||||
{
|
{
|
||||||
$filtered = $this->filterEmptyFields($record['formatted']);
|
$filtered = $this->filterEmptyFields($record['formatted']);
|
||||||
$formatted = $this->client->formatAttributes($filtered);
|
if ($this->version === 3) {
|
||||||
|
$formatted = $this->marshaler->marshalItem($filtered);
|
||||||
|
} else {
|
||||||
|
$formatted = $this->client->formatAttributes($filtered);
|
||||||
|
}
|
||||||
|
|
||||||
$this->client->putItem([
|
$this->client->putItem([
|
||||||
'TableName' => $this->table,
|
'TableName' => $this->table,
|
||||||
|
@@ -48,9 +48,13 @@ class MercurialProcessor
|
|||||||
|
|
||||||
$result = explode(' ', trim(`hg id -nb`));
|
$result = explode(' ', trim(`hg id -nb`));
|
||||||
|
|
||||||
return self::$cache = [
|
if (count($result) >= 3) {
|
||||||
'branch' => $result[1],
|
return self::$cache = [
|
||||||
'revision' => $result[2],
|
'branch' => $result[1],
|
||||||
];
|
'revision' => $result[2],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$cache = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user