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/phpunit/phpunit/src/Logging/EventLogger.php \PHPUnit\Logging\EventLogger

Hierarchy

  • class \OpenTelemetry\SDK\Logs\EventLogger implements \OpenTelemetry\API\Logs\EventLoggerInterface

Expanded class hierarchy of EventLogger

File

vendor/open-telemetry/sdk/Logs/EventLogger.php, line 15

Namespace

OpenTelemetry\SDK\Logs
View source
class EventLogger implements EventLoggerInterface {
    
    /**
     * @internal
     */
    public function __construct(LoggerInterface $logger, ClockInterface $clock) {
    }
    
    /**
     * @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.32.0/specification/logs/event-sdk.md#emit-event
     */
    public function emit(string $name, mixed $body = null, ?int $timestamp = null, ?ContextInterface $context = null, ?Severity $severityNumber = null, iterable $attributes = []) : void {
        $logRecord = new LogRecord();
        $logRecord->setAttribute('event.name', $name);
        $logRecord->setAttributes($attributes);
        $logRecord->setAttribute('event.name', $name);
        $logRecord->setBody($body);
        $logRecord->setTimestamp($timestamp ?? $this->clock
            ->now());
        $logRecord->setContext($context ?? Context::getCurrent());
        $logRecord->setSeverityNumber($severityNumber ?? Severity::INFO);
        $this->logger
            ->emit($logRecord);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
EventLogger::emit public function Overrides EventLoggerInterface::emit
EventLogger::__construct public function @internal

API Navigation

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