You are here

public function LoggerChannelFactory::get in Service Container 7

Same name and namespace in other branches
  1. 7.2 src/Logger/LoggerChannelFactory.php \Drupal\service_container\Logger\LoggerChannelFactory::get()

Retrieves the registered logger for the requested channel.

Return value

\Drupal\Core\Logger\LoggerChannelInterface The registered logger for this channel.

Overrides LoggerChannelFactoryInterface::get

File

src/Logger/LoggerChannelFactory.php, line 35
Contains \Drupal\service_container\Logger\LoggerChannelFactory.

Class

LoggerChannelFactory
Defines a factory for logging channels.

Namespace

Drupal\service_container\Logger

Code

public function get($channel) {
  if (!isset($this->channels[$channel])) {
    $instance = new LoggerChannel($channel);

    // Pass the loggers to the channel.
    $instance
      ->setLoggers($this->loggers);
    $this->channels[$channel] = $instance;
  }
  return $this->channels[$channel];
}