blob: 6833c71f9a9c5e89fab8decfbf34a150667a02a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
<?php
declare(strict_types=1);
namespace OpenTelemetry\API\Logs;
use OpenTelemetry\Context\ContextInterface;
class LogRecord
{
public const NANOS_PER_SECOND = 1_000_000_000;
protected ?int $timestamp = null;
protected ?int $observedTimestamp = null;
protected ?ContextInterface $context = null;
protected int $severityNumber = 0;
protected ?string $severityText = null;
protected $body = null;
protected array $attributes = [];
/**
* @param mixed $body
*/
public function __construct($body = null)
{
$this->body = $body;
}
/**
* @param int $timestamp Timestamp, in nanoseconds since the unix epoch, when the event occurred.
* @see https://opentelemetry.io/docs/reference/specification/logs/data-model/#field-timestamp
*/
public function setTimestamp(int $timestamp): self
{
$this->timestamp = $timestamp;
return $this;
}
public function setContext(?ContextInterface $context = null): self
{
$this->context = $context;
return $this;
}
/**
* @param int $severityNumber Severity number
* @see https://opentelemetry.io/docs/reference/specification/logs/data-model/#field-severitynumber
*/
public function setSeverityNumber(int $severityNumber): self
{
$this->severityNumber = $severityNumber;
return $this;
}
/**
* @param string $severityText Severity text, also known as log level
* @see https://opentelemetry.io/docs/reference/specification/logs/data-model/#field-severitynumber
*/
public function setSeverityText(string $severityText): self
{
$this->severityText = $severityText;
return $this;
}
/**
* @param iterable $attributes Additional information about the specific event occurrence.
* @see https://opentelemetry.io/docs/reference/specification/logs/data-model/#field-attributes
*/
public function setAttributes(iterable $attributes): self
{
foreach ($attributes as $name => $value) {
$this->setAttribute($name, $value);
}
return $this;
}
public function setAttribute(string $name, $value): self
{
$this->attributes[$name] = $value;
return $this;
}
/**
* @param mixed $body The log record body
*/
public function setBody($body = null): self
{
$this->body = $body;
return $this;
}
/**
* @param int|null $observedTimestamp Time, in nanoseconds since the unix epoch, when the event was observed by the collection system.
*/
public function setObservedTimestamp(int $observedTimestamp = null): self
{
$this->observedTimestamp = $observedTimestamp;
return $this;
}
}
|