Skip to content

Commit

Permalink
Support for Monolog 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Aug 16, 2019
1 parent 635bb23 commit bc52eae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions DependencyInjection/MonologExtension.php
Expand Up @@ -11,17 +11,20 @@

namespace Symfony\Bundle\MonologBundle\DependencyInjection;

use Monolog\Logger;
use Monolog\Processor\ProcessorInterface;
use Monolog\ResettableInterface;
use Symfony\Bridge\Monolog\Handler\FingersCrossed\HttpCodeActivationStrategy;
use Symfony\Bridge\Monolog\Processor\TokenProcessor;
use Symfony\Bridge\Monolog\Processor\WebProcessor;
use Symfony\Bundle\FullStack;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Kernel;

/**
* MonologExtension is an extension for the Monolog library.
Expand All @@ -48,6 +51,10 @@ private function levelToMonologConst($level)
*/
public function load(array $configs, ContainerBuilder $container)
{
if (class_exists(FullStack::class) && Kernel::MAJOR_VERSION < 5 && Logger::API >= 2) {
throw new \RuntimeException('Symfony 5 is required for Monolog 2 support. Please downgrade Monolog to version 1.');
}

$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -21,7 +21,7 @@
"symfony/dependency-injection": "~3.4.10 || ^4.0.10 || ^5.0",
"symfony/config": "~3.4 || ~4.0 || ^5.0",
"symfony/http-kernel": "~3.4 || ~4.0 || ^5.0",
"monolog/monolog": "~1.22"
"monolog/monolog": "~1.22 || ~2.0"
},
"require-dev": {
"symfony/yaml": "~3.4 || ~4.0 || ^5.0",
Expand Down

0 comments on commit bc52eae

Please sign in to comment.