LoggerChannelTrait::getLogger

protected LoggerChannelTrait::getLogger($channel)

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.

File

core/lib/Drupal/Core/Logger/LoggerChannelTrait.php, line 37

Class

LoggerChannelTrait
Wrapper methods for the logger factory service.

Namespace

Drupal\Core\Logger

Code

protected function getLogger($channel) {
  if (!$this->loggerFactory) {
    $this->loggerFactory = \Drupal::service('logger.factory');
  }
  return $this->loggerFactory->get($channel);
}
doc_Drupal
2016-10-29 09:25:04
Comments
Leave a Comment

Please login to continue.