diff --git a/core/core.services.yml b/core/core.services.yml index f92f41ea04..03436c7cb3 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -445,9 +445,6 @@ services: logger.channel.security: parent: logger.channel_base arguments: ['security'] - logger.channel.theme: - parent: logger.channel_base - arguments: ['theme'] logger.log_message_parser: class: Drupal\Core\Logger\LogMessageParser @@ -525,7 +522,7 @@ services: class: Drupal\Core\Extension\ModuleInstaller tags: - { name: service_collector, tag: 'module_install.uninstall_validator', call: addUninstallValidator } - arguments: ['%app.root%', '@module_handler', '@kernel', '@logger.channel.default'] + arguments: ['%app.root%', '@module_handler', '@kernel', '@logger.factory'] lazy: true extension.list.module: class: Drupal\Core\Extension\ModuleExtensionList @@ -1493,7 +1490,7 @@ services: shared: false theme.manager: class: Drupal\Core\Theme\ThemeManager - arguments: ['%app.root%', '@theme.negotiator', '@theme.initialization', '@module_handler', '@logger.channel.theme'] + arguments: ['%app.root%', '@theme.negotiator', '@theme.initialization', '@module_handler', '@logger.factory'] calls: - [setThemeRegistry, ['@theme.registry']] theme.initialization: diff --git a/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/core/lib/Drupal/Core/Extension/ModuleInstaller.php index cbb54b30ab..c7954327d0 100644 --- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php +++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php @@ -8,8 +8,8 @@ use Drupal\Core\Entity\EntityStorageException; use Drupal\Core\Entity\FieldableEntityInterface; use Drupal\Core\Installer\InstallerKernel; +use Drupal\Core\Logger\LoggerChannelFactoryInterface; use Drupal\Core\Serialization\Yaml; -use Psr\Log\LoggerInterface; /** * Default implementation of the module installer. @@ -68,21 +68,23 @@ class ModuleInstaller implements ModuleInstallerInterface { * The module handler. * @param \Drupal\Core\DrupalKernelInterface $kernel * The drupal kernel. - * @param \Psr\Log\LoggerInterface|null $logger - * A logger instance. + * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface|null $logger_factory + * The logger factory. * * @see \Drupal\Core\DrupalKernel * @see \Drupal\Core\CoreServiceProvider */ - public function __construct($root, ModuleHandlerInterface $module_handler, DrupalKernelInterface $kernel, LoggerInterface $logger = NULL) { + public function __construct($root, ModuleHandlerInterface $module_handler, DrupalKernelInterface $kernel, LoggerChannelFactoryInterface $logger_factory = NULL) { $this->root = $root; $this->moduleHandler = $module_handler; $this->kernel = $kernel; - if ($logger === NULL) { - @trigger_error('The logger.channel.default service must be passed to ' . __CLASS__ . '::' . __METHOD__ . '(). It was added in drupal:9.1.0 and will be required before drupal:10.0.0. See https://www.drupal.org/node/3160464', E_USER_DEPRECATED); - $logger = \Drupal::service('logger.channel.default'); + if ($logger_factory === NULL) { + @trigger_error('The logger.factory service must be passed to ' . __NAMESPACE__ . '\ModuleInstaller::__construct(). It was added in drupal:9.1.0 and will be required before drupal:10.0.0. See https://www.drupal.org/node/3160464', E_USER_DEPRECATED); + $this->logger = \Drupal::logger('system'); + } + else { + $this->logger = $logger_factory->get('system'); } - $this->logger = $logger; } /** diff --git a/core/lib/Drupal/Core/Theme/ThemeManager.php b/core/lib/Drupal/Core/Theme/ThemeManager.php index 53c3ff176d..dd99f042a1 100644 --- a/core/lib/Drupal/Core/Theme/ThemeManager.php +++ b/core/lib/Drupal/Core/Theme/ThemeManager.php @@ -3,12 +3,12 @@ namespace Drupal\Core\Theme; use Drupal\Component\Render\MarkupInterface; +use Drupal\Core\Extension\ModuleHandlerInterface; +use Drupal\Core\Logger\LoggerChannelFactoryInterface; use Drupal\Core\Render\Markup; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Routing\StackedRouteMatchInterface; -use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Template\Attribute; -use Psr\Log\LoggerInterface; /** * Provides the default implementation of a theme manager. @@ -75,19 +75,21 @@ class ThemeManager implements ThemeManagerInterface { * The theme initialization. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. - * @param \Psr\Log\LoggerInterface|null $logger - * A logger instance. + * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface|null $logger_factory + * The logger factory. */ - public function __construct($root, ThemeNegotiatorInterface $theme_negotiator, ThemeInitializationInterface $theme_initialization, ModuleHandlerInterface $module_handler, LoggerInterface $logger = NULL) { + public function __construct($root, ThemeNegotiatorInterface $theme_negotiator, ThemeInitializationInterface $theme_initialization, ModuleHandlerInterface $module_handler, LoggerChannelFactoryInterface $logger_factory = NULL) { $this->root = $root; $this->themeNegotiator = $theme_negotiator; $this->themeInitialization = $theme_initialization; $this->moduleHandler = $module_handler; - if ($logger === NULL) { - @trigger_error('The logger.channel.theme service must be passed to ' . __CLASS__ . '::' . __METHOD__ . '(). It was added in drupal:9.1.0 and will be required before drupal:10.0.0. See https://www.drupal.org/node/3160464', E_USER_DEPRECATED); - $logger = \Drupal::service('logger.channel.theme'); + if ($logger_factory === NULL) { + @trigger_error('The logger.factory service must be passed to ' . __NAMESPACE__ . '\ThemeManager::__construct(). It was added in drupal:9.1.0 and will be required before drupal:10.0.0. See https://www.drupal.org/node/3160464', E_USER_DEPRECATED); + $this->logger = \Drupal::logger('theme'); + } + else { + $this->logger = $logger_factory->get('theme'); } - $this->logger = $logger; } /**