public function LoggerChannelFactory::addLogger in Service Container 7.2
Same name and namespace in other branches
- 7 src/Logger/LoggerChannelFactory.php \Drupal\service_container\Logger\LoggerChannelFactory::addLogger()
Adds a logger.
Here is were all services tagged as 'logger' are being retrieved and then passed to the channels after instantiation.
Parameters
\Psr\Log\LoggerInterface $logger: The PSR-3 logger to add.
int $priority: The priority of the logger being added.
Overrides LoggerChannelFactoryInterface::addLogger
See also
\Drupal\Core\DependencyInjection\Compiler\RegisterLoggersPass
File
- src/
Logger/ LoggerChannelFactory.php, line 50 - Contains \Drupal\service_container\Logger\LoggerChannelFactory.
Class
- LoggerChannelFactory
- Defines a factory for logging channels.
Namespace
Drupal\service_container\LoggerCode
public function addLogger(LoggerInterface $logger, $priority = 0) {
// Store it so we can pass it to potential new logger instances.
$this->loggers[$priority][] = $logger;
// Add the logger to already instantiated channels.
foreach ($this->channels as $channel) {
$channel
->addLogger($logger, $priority);
}
}