diff --git a/core/core.services.yml b/core/core.services.yml index ef07b85..27a26f0 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -117,6 +117,16 @@ services: tags: - { name: needs_destruction } arguments: ['@database'] + logger.factory: + class: Drupal\Core\Logger\LoggerChannelFactory + calls: + - [setContainer, ['@service_container']] + logger.channel.default: + class: Drupal\Core\Logger\LoggerChannel + calls: + - [setRequest, ['@?request']] + tags: + - { name: logger_channel } settings: class: Drupal\Component\Utility\Settings factory_class: Drupal\Component\Utility\Settings @@ -126,16 +136,6 @@ services: factory_method: get factory_service: keyvalue arguments: [state] - watchdog.factory: - class: Drupal\Core\Watchdog\WatchdogChannelFactory - calls: - - [setContainer, ['@service_container']] - watchdog.channel.default: - class: Drupal\Core\Watchdog\WatchdogChannel - calls: - - [setRequest, ['@?request']] - tags: - - { name: watchdog_channel } queue: class: Drupal\Core\Queue\QueueFactory arguments: ['@settings'] @@ -189,7 +189,7 @@ services: arguments: ['@service_container'] controller_resolver: class: Drupal\Core\Controller\ControllerResolver - arguments: ['@service_container', '@watchdog.channel.default'] + arguments: ['@service_container', '@logger.channel.default'] http_kernel: class: Drupal\Core\HttpKernel arguments: ['@event_dispatcher', '@service_container', '@controller_resolver'] @@ -234,7 +234,7 @@ services: - [setFinalMatcher, ['@router.matcher.final_matcher']] url_generator: class: Drupal\Core\Routing\UrlGenerator - arguments: ['@router.route_provider', '@path_processor_manager', '@config.factory', '@settings', '@watchdog.channel.default'] + arguments: ['@router.route_provider', '@path_processor_manager', '@config.factory', '@settings', '@logger.channel.default'] calls: - [setRequest, ['@?request']] tags: @@ -251,7 +251,7 @@ services: arguments: ['@router.request_context', '@legacy_url_matcher', '@legacy_generator'] router: class: Symfony\Cmf\Component\Routing\ChainRouter - arguments: ['@watchdog.channel.default'] + arguments: ['@logger.channel.default'] calls: - [setContext, ['@router.request_context']] - [add, ['@router.dynamic']] @@ -424,7 +424,7 @@ services: class: Symfony\Component\HttpKernel\EventListener\ExceptionListener tags: - { name: event_subscriber } - arguments: [['@exception_controller', execute], '@watchdog.channel.default'] + arguments: [['@exception_controller', execute], '@logger.channel.default'] path_processor_manager: class: Drupal\Core\PathProcessor\PathProcessorManager path_processor_decode: diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 1eb3295..196bc07 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -1548,7 +1548,7 @@ function watchdog($type, $message, array $variables = NULL, $severity = WATCHDOG if ($link) { $variables['link'] = $link; } - Drupal::service('watchdog.factory')->getLogger($type)->log($severity, $message, $variables); + Drupal::service('logger.factory')->getLogger($type)->log($severity, $message, $variables); } /** diff --git a/core/lib/Drupal/Core/CoreBundle.php b/core/lib/Drupal/Core/CoreBundle.php index acb34cc..a71bf67 100644 --- a/core/lib/Drupal/Core/CoreBundle.php +++ b/core/lib/Drupal/Core/CoreBundle.php @@ -10,6 +10,7 @@ use Drupal\Core\Cache\ListCacheBinsPass; use Drupal\Core\DependencyInjection\Compiler\RegisterKernelListenersPass; use Drupal\Core\DependencyInjection\Compiler\RegisterAccessChecksPass; +use Drupal\Core\DependencyInjection\Compiler\RegisterLoggersPass; use Drupal\Core\DependencyInjection\Compiler\RegisterMatchersPass; use Drupal\Core\DependencyInjection\Compiler\RegisterPathProcessorsPass; use Drupal\Core\DependencyInjection\Compiler\RegisterRouteFiltersPass; @@ -18,7 +19,6 @@ use Drupal\Core\DependencyInjection\Compiler\RegisterServicesForDestructionPass; use Drupal\Core\DependencyInjection\Compiler\RegisterStringTranslatorsPass; use Drupal\Core\DependencyInjection\Compiler\RegisterBreadcrumbBuilderPass; -use Drupal\Core\DependencyInjection\Compiler\RegisterWatchdogLoggersPass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Reference; @@ -69,7 +69,7 @@ public function build(ContainerBuilder $container) { // services. $container->addCompilerPass(new RegisterBreadcrumbBuilderPass()); // Add a compiler pass for registering logging services. - $container->addCompilerPass(new RegisterWatchdogLoggersPass()); + $container->addCompilerPass(new RegisterLoggersPass()); } /** diff --git a/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterWatchdogLoggersPass.php b/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterLoggersPass.php similarity index 70% rename from core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterWatchdogLoggersPass.php rename to core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterLoggersPass.php index 37fdee0..1acb15e 100644 --- a/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterWatchdogLoggersPass.php +++ b/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterLoggersPass.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\Core\DependencyInjection\Compiler\RegisterWatchdogLoggersPass. + * Contains \Drupal\Core\DependencyInjection\Compiler\RegisterLoggersPass. */ namespace Drupal\Core\DependencyInjection\Compiler; @@ -11,19 +11,19 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Reference; -class RegisterWatchdogLoggersPass implements CompilerPassInterface { +class RegisterLoggersPass implements CompilerPassInterface { /** * {@inheritdoc} */ public function process(ContainerBuilder $container) { $definitions = array(); - foreach ($container->findTaggedServiceIds('watchdog_channel') as $id => $attributes) { + foreach ($container->findTaggedServiceIds('logger_channel') as $id => $attributes) { $definitions[] = $container->getDefinition($id); } // Loop through all available logger services (eg dblog, syslog) and add // the available logging channels - foreach ($container->findTaggedServiceIds('watchdog_logger') as $id => $attributes) { + foreach ($container->findTaggedServiceIds('logger') as $id => $attributes) { $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0; foreach ($definitions as $definition) { $definition->addMethodCall('addLogger', array(new Reference($id), $priority)); diff --git a/core/lib/Drupal/Core/Watchdog/WatchdogLoggerBase.php b/core/lib/Drupal/Core/Logger/LoggerBase.php similarity index 90% rename from core/lib/Drupal/Core/Watchdog/WatchdogLoggerBase.php rename to core/lib/Drupal/Core/Logger/LoggerBase.php index 4016bf7..77f0190 100644 --- a/core/lib/Drupal/Core/Watchdog/WatchdogLoggerBase.php +++ b/core/lib/Drupal/Core/Logger/LoggerBase.php @@ -2,17 +2,17 @@ /** * @file - * Contains \Drupal\Core\Watchdog\WatchdogLoggerBase. + * Contains \Drupal\Core\Logger\LoggerBase. */ -namespace Drupal\Core\Watchdog; +namespace Drupal\Core\Logger; use Psr\Log\AbstractLogger; /** - * Defines a base watchdog PSR3 compatible logger class. + * Defines a base PSR3 compatible logger class. */ -abstract class WatchdogLoggerBase extends AbstractLogger { +abstract class LoggerBase extends AbstractLogger { /** * Parses and transforms message and its placeholders to a common format. diff --git a/core/lib/Drupal/Core/Watchdog/WatchdogChannel.php b/core/lib/Drupal/Core/Logger/LoggerChannel.php similarity index 93% rename from core/lib/Drupal/Core/Watchdog/WatchdogChannel.php rename to core/lib/Drupal/Core/Logger/LoggerChannel.php index 6cb3171..027309a 100644 --- a/core/lib/Drupal/Core/Watchdog/WatchdogChannel.php +++ b/core/lib/Drupal/Core/Logger/LoggerChannel.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Watchdog\WatchdogLogger. + * Contains \Drupal\Core\Logger\LoggerChannel. */ -namespace Drupal\Core\Watchdog; +namespace Drupal\Core\Logger; use Psr\Log\AbstractLogger; use Psr\Log\LoggerInterface; @@ -13,9 +13,9 @@ use Symfony\Component\HttpFoundation\Request; /** - * Watchdog-backed implementation of the PSR-3 Logger interface. + * Defines a logger channel that most implementations will use. */ -class WatchdogChannel extends AbstractLogger { +class LoggerChannel extends AbstractLogger { /** * The name of the channel of this logger instance. @@ -44,7 +44,7 @@ class WatchdogChannel extends AbstractLogger { protected $request; /** - * Constructs a WatchdogChannel object + * Constructs a LoggerChannel object * * @param string $channel * The channel name for this instance. diff --git a/core/lib/Drupal/Core/Watchdog/WatchdogChannelFactory.php b/core/lib/Drupal/Core/Logger/LoggerChannelFactory.php similarity index 62% rename from core/lib/Drupal/Core/Watchdog/WatchdogChannelFactory.php rename to core/lib/Drupal/Core/Logger/LoggerChannelFactory.php index 8e83f0e..a53f743 100644 --- a/core/lib/Drupal/Core/Watchdog/WatchdogChannelFactory.php +++ b/core/lib/Drupal/Core/Logger/LoggerChannelFactory.php @@ -2,17 +2,17 @@ /** * @file - * Contains \Drupal\Core\Watchdog\WatchdogChannelFactory. + * Contains \Drupal\Core\Logger\LoggerChannelFactory. */ -namespace Drupal\Core\Watchdog; +namespace Drupal\Core\Logger; use Symfony\Component\DependencyInjection\ContainerAware; /** - * Watchdog channel factory. + * Defines a factory for logging channels. */ -class WatchdogChannelFactory extends ContainerAware { +class LoggerChannelFactory extends ContainerAware { /** * Retrieves the registered logger for the requested channel. @@ -23,12 +23,12 @@ class WatchdogChannelFactory extends ContainerAware { * The registered logger for this channel. */ public function getLogger($channel) { - $channel_service = 'watchdog.channel.' . str_replace(' ', '_', $channel); + $channel_service = 'logger.channel.' . str_replace(' ', '_', $channel); if ($this->container->has($channel_service)) { return $this->container->get($channel_service); } else { - return $this->container->get('watchdog.channel.default'); + return $this->container->get('logger.channel.default'); } } diff --git a/core/modules/action/action.services.yml b/core/modules/action/action.services.yml index bd2b3bb..18a114e 100644 --- a/core/modules/action/action.services.yml +++ b/core/modules/action/action.services.yml @@ -1,8 +1,8 @@ services: - watchdog.channel.action: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.action: + class: Drupal\Core\Logger\LoggerChannel arguments: ['action'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/modules/aggregator/aggregator.services.yml b/core/modules/aggregator/aggregator.services.yml index d3056e8..4bb272f 100644 --- a/core/modules/aggregator/aggregator.services.yml +++ b/core/modules/aggregator/aggregator.services.yml @@ -8,10 +8,10 @@ services: plugin.manager.aggregator.processor: class: Drupal\aggregator\Plugin\AggregatorPluginManager arguments: [processor, '@container.namespaces'] - watchdog.channel.aggregator: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.aggregator: + class: Drupal\Core\Logger\LoggerChannel arguments: ['aggregator'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/modules/block/custom_block/custom_block.services.yml b/core/modules/block/custom_block/custom_block.services.yml index 7aa159d..6edab11 100644 --- a/core/modules/block/custom_block/custom_block.services.yml +++ b/core/modules/block/custom_block/custom_block.services.yml @@ -1,8 +1,8 @@ services: - watchdog.channel.custom_block: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.custom_block: + class: Drupal\Core\Logger\LoggerChannel arguments: ['custom block'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/modules/contact/contact.services.yml b/core/modules/contact/contact.services.yml index 4933c74..9601bbb 100644 --- a/core/modules/contact/contact.services.yml +++ b/core/modules/contact/contact.services.yml @@ -1,8 +1,8 @@ services: - watchdog.channel.contact: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.contact: + class: Drupal\Core\Logger\LoggerChannel arguments: ['contact'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/modules/dblog/dblog.services.yml b/core/modules/dblog/dblog.services.yml index de7d173..c07cb32 100644 --- a/core/modules/dblog/dblog.services.yml +++ b/core/modules/dblog/dblog.services.yml @@ -1,6 +1,6 @@ services: - watchdog.dblog: - class: Drupal\dblog\Watchdog\DbLog + logger.dblog: + class: Drupal\dblog\Logger\DbLog arguments: ['@database'] tags: - - { name: watchdog_logger } + - { name: logger } diff --git a/core/modules/dblog/lib/Drupal/dblog/Watchdog/DbLog.php b/core/modules/dblog/lib/Drupal/dblog/Logger/DbLog.php similarity index 86% rename from core/modules/dblog/lib/Drupal/dblog/Watchdog/DbLog.php rename to core/modules/dblog/lib/Drupal/dblog/Logger/DbLog.php index 8533812..47af121 100644 --- a/core/modules/dblog/lib/Drupal/dblog/Watchdog/DbLog.php +++ b/core/modules/dblog/lib/Drupal/dblog/Logger/DbLog.php @@ -2,18 +2,18 @@ /** * @file - * Contains \Drupal\dblog\Watchdog\DbLog. + * Contains \Drupal\dblog\Logger\DbLog. */ -namespace Drupal\dblog\Watchdog; +namespace Drupal\dblog\Logger; use Drupal\Core\Database\Connection; -use Drupal\Core\Watchdog\WatchdogLoggerBase; +use Drupal\Core\Logger\LoggerBase; /** * Logs events in the watchdog database table. */ -class DbLog extends WatchdogLoggerBase { +class DbLog extends LoggerBase { /** * The database connection object. @@ -23,7 +23,7 @@ class DbLog extends WatchdogLoggerBase { protected $database; /** - * Constructs a DbLogWatchdog object. + * Constructs a DbLog object. * * @param \Drupal\Core\Database\Connection $database * The database connection object. diff --git a/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php b/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php index 32c1e27..3c2bbab 100644 --- a/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php +++ b/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php @@ -145,7 +145,7 @@ private function generateLogEntries($count, $type = 'custom', $severity = WATCHD $message = 'Log entry added to test the dblog row limit. Entry #'; for ($i = 0; $i < $count; $i++) { $log['message'] = $message . $i; - $this->container->get('watchdog.dblog')->log($severity, $log['message'], $log); + $this->container->get('logger.dblog')->log($severity, $log['message'], $log); } } @@ -430,7 +430,7 @@ protected function testDBLogAddAndClear() { 'timestamp' => REQUEST_TIME, ); // Add a watchdog entry. - $this->container->get('watchdog.dblog')->log($log['severity'], $log['message'], $log); + $this->container->get('logger.dblog')->log($log['severity'], $log['message'], $log); // Make sure the table count has actually been incremented. $this->assertEqual($count + 1, db_query('SELECT COUNT(*) FROM {watchdog}')->fetchField(), format_string('dblog_watchdog() added an entry to the dblog :count', array(':count' => $count))); // Login the admin user. diff --git a/core/modules/file/file.services.yml b/core/modules/file/file.services.yml index 824077e..e9f928a 100644 --- a/core/modules/file/file.services.yml +++ b/core/modules/file/file.services.yml @@ -2,10 +2,10 @@ services: file.usage: class: Drupal\file\FileUsage\DatabaseFileUsageBackend arguments: ['@database'] - watchdog.channel.file: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.file: + class: Drupal\Core\Logger\LoggerChannel arguments: ['file'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/modules/filter/filter.services.yml b/core/modules/filter/filter.services.yml index 10e6b9a..4f79be4 100644 --- a/core/modules/filter/filter.services.yml +++ b/core/modules/filter/filter.services.yml @@ -17,10 +17,10 @@ services: plugin.manager.filter: class: Drupal\filter\FilterPluginManager arguments: ['@container.namespaces'] - watchdog.channel.filter: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.filter: + class: Drupal\Core\Logger\LoggerChannel arguments: ['filter'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/modules/forum/forum.services.yml b/core/modules/forum/forum.services.yml index c3ff6cd..a9e5ac8 100644 --- a/core/modules/forum/forum.services.yml +++ b/core/modules/forum/forum.services.yml @@ -4,10 +4,10 @@ services: arguments: ['@plugin.manager.entity', '@config.factory'] tags: - { name: breadcrumb_builder, priority: 1001 } - watchdog.channel.forum: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.forum: + class: Drupal\Core\Logger\LoggerChannel arguments: ['forum'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/modules/image/image.services.yml b/core/modules/image/image.services.yml index 6036a0d..6f327f4 100644 --- a/core/modules/image/image.services.yml +++ b/core/modules/image/image.services.yml @@ -1,8 +1,8 @@ services: - watchdog.channel.image: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.image: + class: Drupal\Core\Logger\LoggerChannel arguments: ['image'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/modules/language/language.services.yml b/core/modules/language/language.services.yml index 1b6615d..b00afe6 100644 --- a/core/modules/language/language.services.yml +++ b/core/modules/language/language.services.yml @@ -5,10 +5,10 @@ services: tags: - { name: path_processor_inbound, priority: 300 } - { name: path_processor_outbound, priority: 100 } - watchdog.channel.language: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.language: + class: Drupal\Core\Logger\LoggerChannel arguments: ['language'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/modules/locale/locale.services.yml b/core/modules/locale/locale.services.yml index e0ac468..d6704d5 100644 --- a/core/modules/locale/locale.services.yml +++ b/core/modules/locale/locale.services.yml @@ -16,10 +16,10 @@ services: tags: - { name: string_translator } - { name: needs_destruction } - watchdog.channel.locale: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.locale: + class: Drupal\Core\Logger\LoggerChannel arguments: ['locale'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/modules/menu/menu.services.yml b/core/modules/menu/menu.services.yml index dbe6840..1d9fcc6 100644 --- a/core/modules/menu/menu.services.yml +++ b/core/modules/menu/menu.services.yml @@ -7,10 +7,10 @@ services: class: Drupal\menu\Access\DeleteMenuAccessCheck tags: - { name: access_check } - watchdog.channel.menu: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.menu: + class: Drupal\Core\Logger\LoggerChannel arguments: ['menu'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/modules/node/node.services.yml b/core/modules/node/node.services.yml index 588369e..348d82d 100644 --- a/core/modules/node/node.services.yml +++ b/core/modules/node/node.services.yml @@ -1,15 +1,15 @@ services: - watchdog.channel.content: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.content: + class: Drupal\Core\Logger\LoggerChannel arguments: ['content'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } - watchdog.channel.node: - class: Drupal\Core\Watchdog\WatchdogChannel + - { name: logger_channel } + logger.channel.node: + class: Drupal\Core\Logger\LoggerChannel arguments: ['node'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/modules/picture/picture.service.yml b/core/modules/picture/picture.service.yml deleted file mode 100644 index b3403b3..0000000 --- a/core/modules/picture/picture.service.yml +++ /dev/null @@ -1,8 +0,0 @@ -services: - watchdog.channel.picture: - class: Drupal\Core\Watchdog\WatchdogChannel - arguments: ['picture'] - calls: - - [setRequest, ['@?request']] - tags: - - { name: watchdog_channel } diff --git a/core/modules/picture/picture.services.yml b/core/modules/picture/picture.services.yml new file mode 100644 index 0000000..fb5fd7b --- /dev/null +++ b/core/modules/picture/picture.services.yml @@ -0,0 +1,8 @@ +services: + logger.channel.picture: + class: Drupal\Core\Logger\LoggerChannel + arguments: ['picture'] + calls: + - [setRequest, ['@?request']] + tags: + - { name: logger_channel } diff --git a/core/modules/rest/rest.services.yml b/core/modules/rest/rest.services.yml index ba9c37f..b069720 100644 --- a/core/modules/rest/rest.services.yml +++ b/core/modules/rest/rest.services.yml @@ -20,10 +20,10 @@ services: rest.link_manager.relation: class: Drupal\rest\LinkManager\RelationLinkManager arguments: ['@cache.cache'] - watchdog.channel.rest: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.rest: + class: Drupal\Core\Logger\LoggerChannel arguments: ['rest'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/modules/rest/tests/modules/rest_test/rest_test.services.yml b/core/modules/rest/tests/modules/rest_test/rest_test.services.yml index 71cb1e6..584d932 100644 --- a/core/modules/rest/tests/modules/rest_test/rest_test.services.yml +++ b/core/modules/rest/tests/modules/rest_test/rest_test.services.yml @@ -1,8 +1,8 @@ services: - watchdog.channel.rest_test: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.rest_test: + class: Drupal\Core\Logger\LoggerChannel arguments: ['rest_test'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/modules/search/search.services.yml b/core/modules/search/search.services.yml index f1704f4..5e09c64 100644 --- a/core/modules/search/search.services.yml +++ b/core/modules/search/search.services.yml @@ -1,8 +1,8 @@ services: - watchdog.channel.search: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.search: + class: Drupal\Core\Logger\LoggerChannel arguments: ['search'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/modules/syslog/lib/Drupal/syslog/Watchdog/SysLog.php b/core/modules/syslog/lib/Drupal/syslog/Logger/SysLog.php similarity index 86% rename from core/modules/syslog/lib/Drupal/syslog/Watchdog/SysLog.php rename to core/modules/syslog/lib/Drupal/syslog/Logger/SysLog.php index 5fd6c8e..48b4d80 100644 --- a/core/modules/syslog/lib/Drupal/syslog/Watchdog/SysLog.php +++ b/core/modules/syslog/lib/Drupal/syslog/Logger/SysLog.php @@ -2,18 +2,18 @@ /** * @file - * Contains \Drupal\syslog\Watchdog\SysLog. + * Contains \Drupal\syslog\Logger\SysLog. */ -namespace Drupal\syslog\Watchdog; +namespace Drupal\syslog\Logger; use Drupal\Core\Config\ConfigFactory; -use Drupal\Core\Watchdog\WatchdogLoggerBase; +use Drupal\Core\Logger\LoggerBase; /** * Redirects logging messages to syslog. */ -class SysLog extends WatchdogLoggerBase { +class SysLog extends LoggerBase { /** * A configuration object containin syslog settings. @@ -23,7 +23,7 @@ class SysLog extends WatchdogLoggerBase { protected $config; /** - * Constructs a SysLogWatchdog object. + * Constructs a SysLog object. * * @param \Drupal\Core\Config\ConfigFactory $config_factory * The configuration factory object. @@ -46,7 +46,7 @@ public function log($level, $message, array $context = array()) { // Populate the $context['variables'] with the message placeholders. $this->parseMessagePlaceholders($message, $context); foreach ($context['variables'] as $key => $variable) { - // A message placeholder will either be format_string() style. + // A message placeholder will be in format_string() style after parsing. if (strpos($key, '@') === 0 || strpos($key, '%') === 0 || strpos($key, '!') === 0) { $variables[$key] = $variable; } diff --git a/core/modules/syslog/syslog.services.yml b/core/modules/syslog/syslog.services.yml index fb081f5..98f6041 100644 --- a/core/modules/syslog/syslog.services.yml +++ b/core/modules/syslog/syslog.services.yml @@ -1,6 +1,6 @@ services: - watchdog.syslog: - class: Drupal\syslog\Watchdog\SysLog + logger.syslog: + class: Drupal\syslog\Logger\SysLog arguments: ['@config.factory'] tags: - - { name: watchdog_logger } + - { name: logger } diff --git a/core/modules/system/system.services.yml b/core/modules/system/system.services.yml index 3a4fc73..cf9a261 100644 --- a/core/modules/system/system.services.yml +++ b/core/modules/system/system.services.yml @@ -17,73 +17,73 @@ services: class: Drupal\system\Routing\RouteSubscriber tags: - { name: event_subscriber } - watchdog.channel.access_denied: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.access_denied: + class: Drupal\Core\Logger\LoggerChannel arguments: ['access denied'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } - watchdog.channel.ajax: - class: Drupal\Core\Watchdog\WatchdogChannel + - { name: logger_channel } + logger.channel.ajax: + class: Drupal\Core\Logger\LoggerChannel arguments: ['ajax'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } - watchdog.channel.cron: - class: Drupal\Core\Watchdog\WatchdogChannel + - { name: logger_channel } + logger.channel.cron: + class: Drupal\Core\Logger\LoggerChannel arguments: ['cron'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } - watchdog.channel.file_system: - class: Drupal\Core\Watchdog\WatchdogChannel + - { name: logger_channel } + logger.channel.file_system: + class: Drupal\Core\Logger\LoggerChannel arguments: ['file system'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } - watchdog.channel.form: - class: Drupal\Core\Watchdog\WatchdogChannel + - { name: logger_channel } + logger.channel.form: + class: Drupal\Core\Logger\LoggerChannel arguments: ['form'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } - watchdog.channel.mail: - class: Drupal\Core\Watchdog\WatchdogChannel + - { name: logger_channel } + logger.channel.mail: + class: Drupal\Core\Logger\LoggerChannel arguments: ['mail'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } - watchdog.channel.theme: - class: Drupal\Core\Watchdog\WatchdogChannel + - { name: logger_channel } + logger.channel.theme: + class: Drupal\Core\Logger\LoggerChannel arguments: ['theme'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } - watchdog.channel.page_not_found: - class: Drupal\Core\Watchdog\WatchdogChannel + - { name: logger_channel } + logger.channel.page_not_found: + class: Drupal\Core\Logger\LoggerChannel arguments: ['page not found'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } - watchdog.channel.php: - class: Drupal\Core\Watchdog\WatchdogChannel + - { name: logger_channel } + logger.channel.php: + class: Drupal\Core\Logger\LoggerChannel arguments: ['php'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } - watchdog.channel.security: - class: Drupal\Core\Watchdog\WatchdogChannel + - { name: logger_channel } + logger.channel.security: + class: Drupal\Core\Logger\LoggerChannel arguments: ['security'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/modules/taxonomy/taxonomy.services.yml b/core/modules/taxonomy/taxonomy.services.yml index 4adc16a..76203e3 100644 --- a/core/modules/taxonomy/taxonomy.services.yml +++ b/core/modules/taxonomy/taxonomy.services.yml @@ -1,8 +1,8 @@ services: - watchdog.channel.taxonomy: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.taxonomy: + class: Drupal\Core\Logger\LoggerChannel arguments: ['taxonomy'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/modules/tracker/tracker.services.yml b/core/modules/tracker/tracker.services.yml index dbb26b0..f14e154 100644 --- a/core/modules/tracker/tracker.services.yml +++ b/core/modules/tracker/tracker.services.yml @@ -1,8 +1,8 @@ services: - watchdog.channel.tracker: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.tracker: + class: Drupal\Core\Logger\LoggerChannel arguments: ['tracker'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/modules/user/user.services.yml b/core/modules/user/user.services.yml index 66fa737..3504f21 100644 --- a/core/modules/user/user.services.yml +++ b/core/modules/user/user.services.yml @@ -25,10 +25,10 @@ services: class: Drupal\user\EventSubscriber\MaintenanceModeSubscriber tags: - { name: event_subscriber } - watchdog.channel.user: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.user: + class: Drupal\Core\Logger\LoggerChannel arguments: ['user'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/modules/views/views.services.yml b/core/modules/views/views.services.yml index 354b2ee..47fd2bb 100644 --- a/core/modules/views/views.services.yml +++ b/core/modules/views/views.services.yml @@ -90,10 +90,10 @@ services: class: Drupal\views\ViewsAccessCheck tags: - { name: 'access_check' } - watchdog.channel.views: - class: Drupal\Core\Watchdog\WatchdogChannel + logger.channel.views: + class: Drupal\Core\Logger\LoggerChannel arguments: ['views'] calls: - [setRequest, ['@?request']] tags: - - { name: watchdog_channel } + - { name: logger_channel } diff --git a/core/tests/Drupal/Tests/Core/Watchdog/WatchdogLoggerBaseTest.php b/core/tests/Drupal/Tests/Core/Logger/LoggerBaseTest.php similarity index 80% rename from core/tests/Drupal/Tests/Core/Watchdog/WatchdogLoggerBaseTest.php rename to core/tests/Drupal/Tests/Core/Logger/LoggerBaseTest.php index c3379c0..4ad7e56 100644 --- a/core/tests/Drupal/Tests/Core/Watchdog/WatchdogLoggerBaseTest.php +++ b/core/tests/Drupal/Tests/Core/Logger/LoggerBaseTest.php @@ -1,22 +1,27 @@ 'Watchdog logger base', - 'description' => 'Unit tests for the watchdog logger base.', - 'group' => 'Watchdog', + 'name' => 'Logger base', + 'description' => 'Unit tests for the logger base.', + 'group' => 'Logger', ); } @@ -24,11 +29,11 @@ public static function getInfo() { * {@inheritdoc} */ protected function setUp() { - $this->logger = $this->getMockForAbstractClass('Drupal\Core\Watchdog\WatchdogLoggerBase'); + $this->logger = $this->getMockForAbstractClass('Drupal\Core\Logger\LoggerBase'); } /** - * Test for WatchdogLoggerBase::parseMessagePlaceholders() + * Test for LoggerBase::parseMessagePlaceholders() * * @param array $value * An array containing: @@ -42,7 +47,7 @@ protected function setUp() { * @dataProvider providerTestParseMessagePlaceholders */ public function testParseMessagePlaceholders(array $value, array $expected) { - $class = new \ReflectionClass('Drupal\Core\Watchdog\WatchdogLoggerBase'); + $class = new \ReflectionClass('Drupal\Core\Logger\LoggerBase'); $method = $class->getMethod('parseMessagePlaceholders'); $method->setAccessible(TRUE); $method->invokeArgs($this->logger, array(&$value['message'], &$value['context']));