Same name and namespace in other branches
- 8.9.x core/lib/Drupal/Core/Logger/LoggerChannelTrait.php \Drupal\Core\Logger\LoggerChannelTrait::getLogger()
- 9 core/lib/Drupal/Core/Logger/LoggerChannelTrait.php \Drupal\Core\Logger\LoggerChannelTrait::getLogger()
Gets the logger for a specific channel.
@todo Require the use of injected services: https://www.drupal.org/node/2733703
Parameters
string $channel: The name of the channel. Can be any string, but the general practice is to use the name of the subsystem calling this.
Return value
\Psr\Log\LoggerInterface The logger for the given channel.
10 calls to LoggerChannelTrait::getLogger()
- BlockContentController::blockContentTypeRedirect in core/
modules/ block_content/ src/ Controller/ BlockContentController.php - Provides a redirect to the list of block types.
- BlockContentController::blockLibraryRedirect in core/
modules/ block_content/ src/ Controller/ BlockContentController.php - Provides a redirect to the content block library.
- BlockContentController::editRedirect in core/
modules/ block_content/ src/ Controller/ BlockContentController.php - Provides a redirect to block edit page.
- FormBase::logger in core/
lib/ Drupal/ Core/ Form/ FormBase.php - Gets the logger for a specific channel.
- ImageItem::preSave in core/
modules/ image/ src/ Plugin/ Field/ FieldType/ ImageItem.php
File
- core/
lib/ Drupal/ Core/ Logger/ LoggerChannelTrait.php, line 37
Class
- LoggerChannelTrait
- Wrapper methods for the logger factory service.
Namespace
Drupal\Core\LoggerCode
protected function getLogger($channel) {
if (!$this->loggerFactory) {
$this->loggerFactory = \Drupal::service('logger.factory');
}
return $this->loggerFactory
->get($channel);
}