Flow PHP

LogEntry

Read onlyYes
FinalYes

Complete log entry ready for processing.

LogEntry wraps the user-provided LogRecord together with contextual information resolved at emit time:

  • InstrumentationScope from the Logger
  • SpanContext from the context storage (for trace correlation)
  • Resolved timestamp

This is the internal type passed to LogProcessor and LogExporter implementations.

Properties

$record  : LogRecord
$resource  : Resource
$scope  : InstrumentationScope
$spanContext  : SpanContext|null
$timestamp  : DateTimeImmutable

Methods

__construct()  : mixed
fromArray()  : self
Create a LogEntry from a normalized array representation.
normalize()  : array{record: array{severity: int, body: string, attributes: array, timestamp: null|string, observedTimestamp: null|string}, resource: array{attributes: array}, scope: array{name: string, version: string, schemaUrl: null|string, attributes: array}, timestamp: string, spanContext: null|array{traceId: array{hex: string}, spanId: array{hex: string}, parentSpanId: null|array{hex: string}, isRemote: bool, traceFlags: array{byte: int}, traceState: array{entries: array}}}
Normalize the LogEntry to an array representation for serialization.

Properties

$timestamp

public DateTimeImmutable $timestamp

Methods

fromArray()

Create a LogEntry from a normalized array representation.

public static fromArray(array{record: array{severity: int, body: string, attributes: array, timestamp: null|string, observedTimestamp: null|string}, resource: array{attributes: array}, scope: array{name: string, version: string, schemaUrl: null|string, attributes: array}, timestamp: string, spanContext: null|array{traceId: array{hex: string}, spanId: array{hex: string}, parentSpanId: null|array{hex: string}, isRemote: bool, traceFlags: array{byte: int}, traceState: array{entries: array}}} $data) : self
Parameters
$data : array{record: array{severity: int, body: string, attributes: array, timestamp: null|string, observedTimestamp: null|string}, resource: array{attributes: array}, scope: array{name: string, version: string, schemaUrl: null|string, attributes: array}, timestamp: string, spanContext: null|array{traceId: array{hex: string}, spanId: array{hex: string}, parentSpanId: null|array{hex: string}, isRemote: bool, traceFlags: array{byte: int}, traceState: array{entries: array}}}

Normalized LogEntry data

Return values
self

normalize()

Normalize the LogEntry to an array representation for serialization.

public normalize() : array{record: array{severity: int, body: string, attributes: array, timestamp: null|string, observedTimestamp: null|string}, resource: array{attributes: array}, scope: array{name: string, version: string, schemaUrl: null|string, attributes: array}, timestamp: string, spanContext: null|array{traceId: array{hex: string}, spanId: array{hex: string}, parentSpanId: null|array{hex: string}, isRemote: bool, traceFlags: array{byte: int}, traceState: array{entries: array}}}
Return values
array{record: array{severity: int, body: string, attributes: array, timestamp: null|string, observedTimestamp: null|string}, resource: array{attributes: array}, scope: array{name: string, version: string, schemaUrl: null|string, attributes: array}, timestamp: string, spanContext: null|array{traceId: array{hex: string}, spanId: array{hex: string}, parentSpanId: null|array{hex: string}, isRemote: bool, traceFlags: array{byte: int}, traceState: array{entries: array}}}

        
On this page

Search results