scope = $scope; $this->loggerSharedState = $loggerSharedState; 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; } }