class NaughtyRecursiveLogger

Stub class for testing LoggerChannel.

Hierarchy

  • class \Drupal\Tests\Core\Logger\NaughtyRecursiveLogger implements \Psr\Log\LoggerInterface uses \Psr\Log\LoggerTrait

Expanded class hierarchy of NaughtyRecursiveLogger

File

core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php, line 195

Namespace

Drupal\Tests\Core\Logger
View source
class NaughtyRecursiveLogger implements LoggerInterface {
  use LoggerTrait;
  
  /**
   * The logger channel.
   *
   * @var \Drupal\Core\Logger\LoggerChannel
   */
  protected $channel;
  
  /**
   * The message to log.
   *
   * @var string|\Stringable
   */
  protected $message;
  public function __construct(LoggerChannel $channel) {
    $this->channel = $channel;
  }
  public function log($level, string|\Stringable $message, array $context = []) : void {
    $this->channel
      ->log(rand(0, 7), $message, $context);
  }

}

Members

Title Sort descending Modifiers Object type Summary
NaughtyRecursiveLogger::$channel protected property The logger channel.
NaughtyRecursiveLogger::$message protected property The message to log.
NaughtyRecursiveLogger::log public function
NaughtyRecursiveLogger::__construct public function

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