|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace OpenTelemetry\API\Logs; |
| 6 | + |
| 7 | +use OpenTelemetry\Context\ContextInterface; |
| 8 | +use Throwable; |
| 9 | + |
| 10 | +interface LogRecordBuilderInterface |
| 11 | +{ |
| 12 | + /** |
| 13 | + * Time when the event occurred measured by the origin clock, i.e. the time at the source. |
| 14 | + * |
| 15 | + * @param int $timestamp nanoseconds since UNIX epoch |
| 16 | + * @see https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-timestamp |
| 17 | + */ |
| 18 | + public function setTimestamp(int $timestamp): LogRecordBuilderInterface; |
| 19 | + |
| 20 | + /** |
| 21 | + * Time when the event was observed by the collection system |
| 22 | + * |
| 23 | + * @param int $timestamp nanoseconds since UNIX epoch |
| 24 | + * @see https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-observedtimestamp |
| 25 | + */ |
| 26 | + public function setObservedTimestamp(int $timestamp): LogRecordBuilderInterface; |
| 27 | + |
| 28 | + /** |
| 29 | + * @param ContextInterface|false|null $context the log context, null to use the current |
| 30 | + * context, false to use no context |
| 31 | + * @see https://opentelemetry.io/docs/specs/otel/logs/data-model/#trace-context-fields |
| 32 | + */ |
| 33 | + public function setContext(ContextInterface|false|null $context): LogRecordBuilderInterface; |
| 34 | + |
| 35 | + /** |
| 36 | + * Numerical value of the severity. |
| 37 | + * |
| 38 | + * @see https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-severitynumber |
| 39 | + */ |
| 40 | + public function setSeverityNumber(int|Severity $severityNumber): LogRecordBuilderInterface; |
| 41 | + |
| 42 | + /** |
| 43 | + * The original string representation of the severity as it is known at the source. |
| 44 | + * |
| 45 | + * @see https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-severitytext |
| 46 | + */ |
| 47 | + public function setSeverityText(string $severityText): LogRecordBuilderInterface; |
| 48 | + |
| 49 | + /** |
| 50 | + * @see https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-body |
| 51 | + */ |
| 52 | + public function setBody(mixed $body): LogRecordBuilderInterface; |
| 53 | + |
| 54 | + /** |
| 55 | + * @see https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-attributes |
| 56 | + */ |
| 57 | + public function setAttribute(string $key, mixed $value): LogRecordBuilderInterface; |
| 58 | + |
| 59 | + /** |
| 60 | + * @see https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-attributes |
| 61 | + */ |
| 62 | + public function setAttributes(iterable $attributes): LogRecordBuilderInterface; |
| 63 | + |
| 64 | + /** |
| 65 | + * Sets the `exception.message` `exception.type`, and `exception.stacktrace` attributes. |
| 66 | + * |
| 67 | + * @see https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-logs/#attributes |
| 68 | + */ |
| 69 | + public function setException(Throwable $exception): LogRecordBuilderInterface; |
| 70 | + |
| 71 | + /** |
| 72 | + * @see https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-eventname |
| 73 | + */ |
| 74 | + public function setEventName(string $eventName): LogRecordBuilderInterface; |
| 75 | + |
| 76 | + /** |
| 77 | + * @see https://opentelemetry.io/docs/specs/otel/logs/api/#emit-a-logrecord |
| 78 | + */ |
| 79 | + public function emit(): void; |
| 80 | +} |
0 commit comments