Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EventLogger.php

class EventLogger

Same name in this branch
  1. 11.1.x vendor/open-telemetry/sdk/Logs/EventLogger.php \OpenTelemetry\SDK\Logs\EventLogger

@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit

@internal This class is not covered by the backward compatibility promise for PHPUnit

Hierarchy

  • class \PHPUnit\Logging\EventLogger implements \PHPUnit\Event\Tracer\Tracer

Expanded class hierarchy of EventLogger

1 file declares its use of EventLogger
Application.php in vendor/phpunit/phpunit/src/TextUI/Application.php

File

vendor/phpunit/phpunit/src/Logging/EventLogger.php, line 29

Namespace

PHPUnit\Logging
View source
final class EventLogger implements Tracer {
    private readonly string $path;
    private readonly bool $includeTelemetryInfo;
    public function __construct(string $path, bool $includeTelemetryInfo) {
        $this->path = $path;
        $this->includeTelemetryInfo = $includeTelemetryInfo;
    }
    public function trace(Event $event) : void {
        $telemetryInfo = $this->telemetryInfo($event);
        $indentation = PHP_EOL . str_repeat(' ', strlen($telemetryInfo));
        $lines = preg_split('/\\r\\n|\\r|\\n/', $event->asString());
        $flags = FILE_APPEND;
        if (!(PHP_OS_FAMILY === 'Windows' || PHP_OS_FAMILY === 'Darwin') || $this->path !== 'php://stdout') {
            $flags |= LOCK_EX;
        }
        file_put_contents($this->path, $telemetryInfo . implode($indentation, $lines) . PHP_EOL, $flags);
    }
    private function telemetryInfo(Event $event) : string {
        if (!$this->includeTelemetryInfo) {
            return '';
        }
        return $event->telemetryInfo()
            ->asString() . ' ';
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
EventLogger::$includeTelemetryInfo private property
EventLogger::$path private property
EventLogger::telemetryInfo private function
EventLogger::trace public function Overrides Tracer::trace
EventLogger::__construct public function

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal