You are here

public static function Drupal::logger in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal.php \Drupal::logger()
  2. 9 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.

54 calls to Drupal::logger()
authorize.php in core/authorize.php
Administrative script for running authorized file operations.
comment_entity_view_display_presave in core/modules/comment/comment.module
Implements hook_ENTITY_TYPE_presave() for entity_view_display entities.
ConfigImporterBatch::finish in core/lib/Drupal/Core/Config/Importer/ConfigImporterBatch.php
Finish batch.
CronAccessCheck::access in core/modules/system/src/Access/CronAccessCheck.php
Checks access.
DbLogControllerTest::testNonLatinCharacters in core/modules/dblog/tests/src/Kernel/DbLogControllerTest.php
Tests links with non latin characters.

... See full list

File

core/lib/Drupal.php, line 662

Class

Drupal
Static Service Container wrapper.

Code

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