function 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
-
core/
lib/ Drupal/ Core/ Logger/ LoggerChannelFactory.php, line 45
Class
- LoggerChannelFactory
- Defines a factory for logging channels.
Namespace
Drupal\Core\LoggerCode
public function get($channel) {
if (!isset($this->channels[$channel])) {
$instance = new LoggerChannel($channel);
// Set the request_stack and current_user services on the channel.
// It is up to the channel to determine if there is a current request.
$instance->setRequestStack($this->requestStack);
$instance->setCurrentUser($this->currentUser);
// Pass the loggers to the channel.
$instance->setLoggers($this->loggers);
$this->channels[$channel] = $instance;
}
return $this->channels[$channel];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.