function Drupal::logger

Same name in other branches
  1. 8.9.x core/lib/Drupal.php \Drupal::logger()
  2. 10 core/lib/Drupal.php \Drupal::logger()
  3. 11.x core/lib/Drupal.php \Drupal::logger()

Returns a channel logger object.

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 this channel.

9 calls to Drupal::logger()
ConfigImporterBatch::finish in core/lib/Drupal/Core/Config/Importer/ConfigImporterBatch.php
Finish batch.
DbLogFormInjectionTest::setUp in core/modules/dblog/tests/src/Kernel/DbLogFormInjectionTest.php
EntityDisplayBase::getLogger in core/lib/Drupal/Core/Entity/EntityDisplayBase.php
Provides the 'system' channel logger service.
locale_translate_batch_finished in core/modules/locale/locale.bulk.inc
Implements callback_batch_finished().
locale_translation_http_check in core/modules/locale/locale.batch.inc
Check if remote file exists and when it was last updated.

... See full list

File

core/lib/Drupal.php, line 682

Class

Drupal
Static Service Container wrapper.

Code

public static function logger($channel) {
    return static::getContainer()->get('logger.factory')
        ->get($channel);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.