Micro-PHP /
plugin-logger-monolog
| 1 | <?php |
||
| 2 | |||
| 3 | /* |
||
| 4 | * This file is part of the Micro framework package. |
||
| 5 | * |
||
| 6 | * (c) Stanislau Komar <[email protected]> |
||
| 7 | * |
||
| 8 | * For the full copyright and license information, please view the LICENSE |
||
| 9 | * file that was distributed with this source code. |
||
| 10 | */ |
||
| 11 | |||
| 12 | namespace Micro\Plugin\Logger\Monolog\Business\Handler; |
||
| 13 | |||
| 14 | use Micro\Plugin\Logger\Configuration\LoggerProviderTypeConfigurationInterface; |
||
| 15 | use Micro\Plugin\Logger\Monolog\Configuration\Logger\MonologPluginConfigurationInterface; |
||
| 16 | |||
| 17 | readonly class HandlerResolver implements HandlerResolverInterface |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 18 | { |
||
| 19 | 2 | public function __construct( |
|
| 20 | private MonologPluginConfigurationInterface $pluginConfiguration, |
||
| 21 | private HandlerProviderInterface $handlerProvider, |
||
| 22 | private LoggerProviderTypeConfigurationInterface $loggerProviderTypeConfiguration |
||
| 23 | ) { |
||
| 24 | 2 | } |
|
| 25 | |||
| 26 | 1 | public function resolve(): \Traversable |
|
| 27 | { |
||
| 28 | 1 | $loggerConfiguration = $this->pluginConfiguration |
|
| 29 | 1 | ->getLoggerConfiguration($this->loggerProviderTypeConfiguration->getLoggerName()); |
|
| 30 | |||
| 31 | 1 | foreach ($loggerConfiguration->getHandlerList() as $handlerName) { |
|
| 32 | 1 | yield $this->handlerProvider->getHandler($this->loggerProviderTypeConfiguration, $handlerName); |
|
| 33 | } |
||
| 34 | } |
||
| 35 | } |
||
| 36 |