. */ namespace vierbergenlars\AuthserverExternalLoggingBundle; use App\Plugin\PluginEvents; use App\Plugin\Event\ContainerConfigEvent; use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use vierbergenlars\AuthserverExternalLoggingBundle\DependencyInjection\AuthserverExternalLoggingExtension; class AuthserverExternalLoggingBundle extends Bundle implements EventSubscriberInterface { public static function getSubscribedEvents() { return [ PluginEvents::CONTAINER_CONFIG => [ 'onContainerConfig', -20 ] ]; } public function onContainerConfig(ContainerConfigEvent $event) { $handlersManipulator = $event->getConfigManipulator('[monolog][handlers]'); $handlers = $handlersManipulator->getConfig(); if (!$handlers) { $handlersManipulator->prependConfig([ 'null' => [ 'type' => 'null' ] ]); $handlers = $handlersManipulator->getConfig(); } foreach ($handlers as $handlerName => $conf) { // Special types that are used to filter messages before they are logged. if (!in_array($conf['type'], [ 'fingers_crossed', 'filter', 'buffer', 'deduplication' ])) break; } $handlersManipulator->prependConfig([ 'vl_external_logging_splitter_' . $handlerName => [ 'type' => 'whatfailuregroup', 'members' => [ $handlerName, 'vl_external_logging_entry' ] ] ], $handlerName); $handlersManipulator->appendConfig([ 'vl_external_logging_entry' => [ 'type' => 'null' ] ]); var_dump($handlersManipulator->getConfig()); } public function getContainerExtension() { return new AuthserverExternalLoggingExtension(); } }