class LoggerChannelFactory in TMGMT Translator Smartling 8.4
Same name and namespace in other branches
- 8.3 modules/tmgmt_smartling_log_settings/src/Logger/LoggerChannelFactory.php \Drupal\tmgmt_smartling_log_settings\Logger\LoggerChannelFactory
Defines a factory for logging channels.
Hierarchy
- class \Drupal\Core\Logger\LoggerChannelFactory implements \Symfony\Component\DependencyInjection\ContainerAwareInterface, LoggerChannelFactoryInterface uses \Symfony\Component\DependencyInjection\ContainerAwareTrait
- class \Drupal\tmgmt_smartling_log_settings\Logger\LoggerChannelFactory
Expanded class hierarchy of LoggerChannelFactory
1 file declares its use of LoggerChannelFactory
- TmgmtSmartlingLogSettingsServiceProvider.php in modules/
tmgmt_smartling_log_settings/ src/ TmgmtSmartlingLogSettingsServiceProvider.php
File
- modules/
tmgmt_smartling_log_settings/ src/ Logger/ LoggerChannelFactory.php, line 10
Namespace
Drupal\tmgmt_smartling_log_settings\LoggerView source
class LoggerChannelFactory extends LoggerChannelFactoryCore {
/**
* {@inheritdoc}
*/
public function get($channel) {
if (!isset($this->channels[$channel])) {
// Same as core's LoggerChannelFactory but we instantiate
// Drupal\tmgmt_smartling_log_settings\Logger\LoggerChannel instead
// of Drupal\Core\Logger\LoggerChannelFactory.
$instance = new LoggerChannel($channel);
// If we have a container 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.
if ($this->container) {
$instance
->setRequestStack($this->container
->get('request_stack'));
$instance
->setCurrentUser($this->container
->get('current_user'));
}
// Pass the loggers to the channel.
$instance
->setLoggers($this->loggers);
$this->channels[$channel] = $instance;
}
return $this->channels[$channel];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LoggerChannelFactory:: |
protected | property | Array of all instantiated logger channels keyed by channel name. | |
LoggerChannelFactory:: |
protected | property | An array of arrays of \Psr\Log\LoggerInterface keyed by priority. | |
LoggerChannelFactory:: |
public | function |
Adds a logger to all the channels. Overrides LoggerChannelFactoryInterface:: |
|
LoggerChannelFactory:: |
public | function |
Retrieves the registered logger for the requested channel. Overrides LoggerChannelFactory:: |