diff --git a/src/JiraClient.php b/src/JiraClient.php index ad6ccbf..fd2ee40 100644 --- a/src/JiraClient.php +++ b/src/JiraClient.php @@ -92,7 +92,18 @@ public function __construct(ConfigurationInterface $configuration = null, Logger } } else { $this->log = new Logger('JiraClient'); - $this->log->pushHandler(new NoOperationMonologHandler()); + + // Monolog 3.x has a breaking change, so I have to add this dirty code. + $ver = \Composer\InstalledVersions::getVersion('monolog/monolog'); + $major = intval(explode('.', $ver)[0]); + + if ($major === 2) { + $this->log->pushHandler(new NoOperationMonologHandler()); + } elseif ($major === 3) { + $this->log->pushHandler(new NoOperationMonologHandlerV3()); + } else { + throw new JiraException("Unsupported Monolog version $major"); + } } $this->http_response = 200; diff --git a/src/NoOperationMonologHandlerV3.php b/src/NoOperationMonologHandlerV3.php new file mode 100644 index 0000000..e874d5f --- /dev/null +++ b/src/NoOperationMonologHandlerV3.php @@ -0,0 +1,14 @@ +