Skip to content

Commit

Permalink
Fixed previous commit (CS)
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrixx committed Jun 3, 2019
1 parent 4fb28f7 commit 9667b1f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -7,7 +7,7 @@
* Fixed psr-3 processing being applied to all handlers, only leaf ones are now processing
* Fixed regression when `app` channel is defined explicitly
* Fixed handlers marked as nested not being ignored properly from the stack
* Added configuration support for Redis
* Added support for Redis configuration

## 3.3.1 (2018-11-04)

Expand Down
10 changes: 4 additions & 6 deletions DependencyInjection/MonologExtension.php
Expand Up @@ -13,8 +13,6 @@

use Monolog\Processor\ProcessorInterface;
use Monolog\ResettableInterface;
use Predis;
use Redis;
use Symfony\Bridge\Monolog\Handler\FingersCrossed\HttpCodeActivationStrategy;
use Symfony\Bridge\Monolog\Processor\TokenProcessor;
use Symfony\Bridge\Monolog\Processor\WebProcessor;
Expand Down Expand Up @@ -318,23 +316,23 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
if (isset($handler['redis']['id'])) {
$clientId = $handler['redis']['id'];
} elseif ('redis' === $handler['type']) {
if (!class_exists(Redis::class)) {
if (!class_exists(\Redis::class)) {
throw new \RuntimeException('The \Redis class is not available.');
}

$client = new Definition('\Redis');
$client = new Definition(\Redis::class);
$client->addMethodCall('connect', array($handler['redis']['host'], $handler['redis']['port']));
$client->addMethodCall('auth', array($handler['redis']['password']));
$client->addMethodCall('select', array($handler['redis']['database']));
$client->setPublic(false);
$clientId = uniqid('monolog.redis.client.', true);
$container->setDefinition($clientId, $client);
} else {
if (!class_exists(Predis\Client::class)) {
if (!class_exists(\Predis\Client::class)) {
throw new \RuntimeException('The \Predis\Client class is not available.');
}

$client = new Definition('\Predis\Client');
$client = new Definition(\Predis\Client::class);
$client->setArguments(array(
$handler['redis']['host'],
));
Expand Down

0 comments on commit 9667b1f

Please sign in to comment.