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

Breadcrumb

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

class ReadableLogRecord

"Note: Typically this will be implemented with a new interface or (immutable) value type."

Hierarchy

  • class \OpenTelemetry\API\Logs\LogRecord
    • class \OpenTelemetry\SDK\Logs\ReadableLogRecord extends \OpenTelemetry\API\Logs\LogRecord

Expanded class hierarchy of ReadableLogRecord

See also

https://github.com/open-telemetry/opentelemetry-specification/blob/main…

3 files declare their use of ReadableLogRecord
ConsoleExporter.php in vendor/open-telemetry/sdk/Logs/Exporter/ConsoleExporter.php
LogsConverter.php in vendor/open-telemetry/exporter-otlp/LogsConverter.php
LogsExporter.php in vendor/open-telemetry/exporter-otlp/LogsExporter.php

File

vendor/open-telemetry/sdk/Logs/ReadableLogRecord.php, line 21

Namespace

OpenTelemetry\SDK\Logs
View source
class ReadableLogRecord extends LogRecord {
    protected AttributesInterface $convertedAttributes;
    protected SpanContextInterface $spanContext;
    public function __construct(InstrumentationScopeInterface $scope, LoggerSharedState $loggerSharedState, LogRecord $logRecord) {
        parent::__construct($logRecord->body);
        $this->timestamp = $logRecord->timestamp;
        $this->observedTimestamp = $logRecord->observedTimestamp ?? (int) (microtime(true) * LogRecord::NANOS_PER_SECOND);
        $this->context = $logRecord->context;
        $context = $this->context ?? Context::getCurrent();
        $this->spanContext = Span::fromContext($context)->getContext();
        $this->severityNumber = $logRecord->severityNumber;
        $this->severityText = $logRecord->severityText;
        
        //convert attributes now so that excess data is not sent to processors
        $this->convertedAttributes = $this->loggerSharedState
            ->getLogRecordLimits()
            ->getAttributeFactory()
            ->builder($logRecord->attributes, new LogRecordAttributeValidator())
            ->build();
    }
    public function getInstrumentationScope() : InstrumentationScopeInterface {
        return $this->scope;
    }
    public function getResource() : ResourceInfo {
        return $this->loggerSharedState
            ->getResource();
    }
    public function getTimestamp() : ?int {
        return $this->timestamp;
    }
    public function getObservedTimestamp() : ?int {
        return $this->observedTimestamp;
    }
    public function getContext() : ?ContextInterface {
        return $this->context;
    }
    public function getSpanContext() : ?SpanContextInterface {
        return $this->spanContext;
    }
    public function getSeverityNumber() : ?int {
        return $this->severityNumber;
    }
    public function getSeverityText() : ?string {
        return $this->severityText;
    }
    
    /**
     * @return mixed|null
     */
    public function getBody() {
        return $this->body;
    }
    public function getAttributes() : AttributesInterface {
        return $this->convertedAttributes;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
LogRecord::$attributes protected property
LogRecord::$context protected property
LogRecord::$observedTimestamp protected property
LogRecord::$severityNumber protected property
LogRecord::$severityText protected property
LogRecord::$timestamp protected property
LogRecord::NANOS_PER_SECOND public constant
LogRecord::setAttribute public function
LogRecord::setAttributes public function
LogRecord::setBody public function
LogRecord::setContext public function
LogRecord::setObservedTimestamp public function
LogRecord::setSeverityNumber public function
LogRecord::setSeverityText public function
LogRecord::setTimestamp public function
ReadableLogRecord::$convertedAttributes protected property
ReadableLogRecord::$spanContext protected property
ReadableLogRecord::getAttributes public function
ReadableLogRecord::getBody public function
ReadableLogRecord::getContext public function
ReadableLogRecord::getInstrumentationScope public function
ReadableLogRecord::getObservedTimestamp public function
ReadableLogRecord::getResource public function
ReadableLogRecord::getSeverityNumber public function
ReadableLogRecord::getSeverityText public function
ReadableLogRecord::getSpanContext public function
ReadableLogRecord::getTimestamp public function
ReadableLogRecord::__construct public function Overrides LogRecord::__construct

API Navigation

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