You are here

class LdapDetailLog in Lightweight Directory Access Protocol (LDAP) 8.4

Same name and namespace in other branches
  1. 8.3 ldap_servers/src/Logger/LdapDetailLog.php \Drupal\ldap_servers\Logger\LdapDetailLog

The detailed logger for the LDAP modules.

This logger is only active when the ldap_servers setting watchdog_detail is active. It passes messages to the regular logger with priority debug.

Hierarchy

Expanded class hierarchy of LdapDetailLog

5 files declare their use of LdapDetailLog
DrupalUserProcessor.php in ldap_user/src/Processor/DrupalUserProcessor.php
GroupUserUpdateProcessor.php in ldap_user/src/Processor/GroupUserUpdateProcessor.php
LdapEntryProvisionSubscriber.php in ldap_user/src/EventSubscriber/LdapEntryProvisionSubscriber.php
LoginValidatorBase.php in ldap_authentication/src/Controller/LoginValidatorBase.php
TokenProcessor.php in ldap_servers/src/Processor/TokenProcessor.php
1 string reference to 'LdapDetailLog'
ldap_servers.services.yml in ldap_servers/ldap_servers.services.yml
ldap_servers/ldap_servers.services.yml
1 service uses LdapDetailLog
ldap.detail_log in ldap_servers/ldap_servers.services.yml
Drupal\ldap_servers\Logger\LdapDetailLog

File

ldap_servers/src/Logger/LdapDetailLog.php, line 16

Namespace

Drupal\ldap_servers\Logger
View source
class LdapDetailLog {

  /**
   * Logger.
   *
   * @var \Drupal\Core\Logger\LoggerChannelFactoryInterface
   */
  protected $loggerFactory;

  /**
   * Config.
   *
   * @var \Drupal\Core\Config\ImmutableConfig
   */
  protected $config;

  /**
   * LdapDetailLog constructor.
   *
   * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $factory
   *   Logger factory.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config
   *   Config factory.
   */
  public function __construct(LoggerChannelFactoryInterface $factory, ConfigFactoryInterface $config) {
    $this->loggerFactory = $factory;
    $this->config = $config
      ->get('ldap_servers.settings');
  }

  /**
   * If detailed logging is enabled, log to Drupal log more details.
   *
   * @param string $message
   *   Log message.
   * @param array $context
   *   Values to replace in log.
   * @param string $module
   *   Logging channel to use.
   */
  public function log(string $message, array $context = [], string $module = 'ldap_servers') : void {
    if ($this->config
      ->get('watchdog_detail')) {
      $this->loggerFactory
        ->get($module)
        ->debug($message, $context);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LdapDetailLog::$config protected property Config.
LdapDetailLog::$loggerFactory protected property Logger.
LdapDetailLog::log public function If detailed logging is enabled, log to Drupal log more details.
LdapDetailLog::__construct public function LdapDetailLog constructor.