Debian Codegraph @

pdata/plog/generated_logrecord.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 // Code generated by "internal/cmd/pdatagen/main.go". DO NOT EDIT.
5 // To regenerate this file run "make genpdata".
6
7 package plog
8
9 import (
10 "go.opentelemetry.io/collector/pdata/internal"
11 "go.opentelemetry.io/collector/pdata/pcommon"
12 )
13
14 // LogRecord are experimental implementation of OpenTelemetry Log Data Model.
15
16 // This is a reference type, if passed by value and callee modifies it the
17 // caller will see the modification.
18 //
19 // Must use NewLogRecord function to create new instances.
20 // Important: zero-initialized instance is not valid for use.
21 type LogRecord struct {
22 orig *internal.LogRecord
23 state *internal.State
24 }
25
26 func newLogRecord(orig *internal.LogRecord, state *internal.State) LogRecord {
27 return LogRecord{orig: orig, state: state}
28 }
29
30 // NewLogRecord creates a new empty LogRecord.
31 //
32 // This must be used only in testing code. Users should use "AppendEmpty" when part of a Slice,
33 // OR directly access the member if this is embedded in another struct.
34 func NewLogRecord() LogRecord {
35 return newLogRecord(internal.NewLogRecord(), internal.NewState())
36 }
37
38 // MoveTo moves all properties from the current struct overriding the destination and
39 // resetting the current instance to its zero value
40 func (ms LogRecord) MoveTo(dest LogRecord) {
41 ms.state.AssertMutable()
42 dest.state.AssertMutable()
43 // If they point to the same data, they are the same, nothing to do.
44 if ms.orig == dest.orig {
45 return
46 }
47 internal.DeleteLogRecord(dest.orig, false)
48 *dest.orig, *ms.orig = *ms.orig, *dest.orig
49 }
50
51 // Timestamp returns the timestamp associated with this LogRecord.
52 func (ms LogRecord) Timestamp() pcommon.Timestamp {
53 return pcommon.Timestamp(ms.orig.TimeUnixNano)
54 }
55
56 // SetTimestamp replaces the timestamp associated with this LogRecord.
57 func (ms LogRecord) SetTimestamp(v pcommon.Timestamp) {
58 ms.state.AssertMutable()
59 ms.orig.TimeUnixNano = uint64(v)
60 }
61
62 // ObservedTimestamp returns the observedtimestamp associated with this LogRecord.
63 func (ms LogRecord) ObservedTimestamp() pcommon.Timestamp {
64 return pcommon.Timestamp(ms.orig.ObservedTimeUnixNano)
65 }
66
67 // SetObservedTimestamp replaces the observedtimestamp associated with this LogRecord.
68 func (ms LogRecord) SetObservedTimestamp(v pcommon.Timestamp) {
69 ms.state.AssertMutable()
70 ms.orig.ObservedTimeUnixNano = uint64(v)
71 }
72
73 // SeverityNumber returns the severitynumber associated with this LogRecord.
74 func (ms LogRecord) SeverityNumber() SeverityNumber {
75 return SeverityNumber(ms.orig.SeverityNumber)
76 }
77
78 // SetSeverityNumber replaces the severitynumber associated with this LogRecord.
79 func (ms LogRecord) SetSeverityNumber(v SeverityNumber) {
80 ms.state.AssertMutable()
81 ms.orig.SeverityNumber = internal.SeverityNumber(v)
82 }
83
84 // SeverityText returns the severitytext associated with this LogRecord.
85 func (ms LogRecord) SeverityText() string {
86 return ms.orig.SeverityText
87 }
88
89 // SetSeverityText replaces the severitytext associated with this LogRecord.
90 func (ms LogRecord) SetSeverityText(v string) {
91 ms.state.AssertMutable()
92 ms.orig.SeverityText = v
93 }
94
95 // Body returns the body associated with this LogRecord.
96 func (ms LogRecord) Body() pcommon.Value {
97 return pcommon.Value(internal.NewValueWrapper(&ms.orig.Body, ms.state))
98 }
99
100 // Attributes returns the Attributes associated with this LogRecord.
101 func (ms LogRecord) Attributes() pcommon.Map {
102 return pcommon.Map(internal.NewMapWrapper(&ms.orig.Attributes, ms.state))
103 }
104
105 // DroppedAttributesCount returns the droppedattributescount associated with this LogRecord.
106 func (ms LogRecord) DroppedAttributesCount() uint32 {
107 return ms.orig.DroppedAttributesCount
108 }
109
110 // SetDroppedAttributesCount replaces the droppedattributescount associated with this LogRecord.
111 func (ms LogRecord) SetDroppedAttributesCount(v uint32) {
112 ms.state.AssertMutable()
113 ms.orig.DroppedAttributesCount = v
114 }
115
116 // Flags returns the flags associated with this LogRecord.
117 func (ms LogRecord) Flags() LogRecordFlags {
118 return LogRecordFlags(ms.orig.Flags)
119 }
120
121 // SetFlags replaces the flags associated with this LogRecord.
122 func (ms LogRecord) SetFlags(v LogRecordFlags) {
123 ms.state.AssertMutable()
124 ms.orig.Flags = uint32(v)
125 }
126
127 // TraceID returns the traceid associated with this LogRecord.
128 func (ms LogRecord) TraceID() pcommon.TraceID {
129 return pcommon.TraceID(ms.orig.TraceId)
130 }
131
132 // SetTraceID replaces the traceid associated with this LogRecord.
133 func (ms LogRecord) SetTraceID(v pcommon.TraceID) {
134 ms.state.AssertMutable()
135 ms.orig.TraceId = internal.TraceID(v)
136 }
137
138 // SpanID returns the spanid associated with this LogRecord.
139 func (ms LogRecord) SpanID() pcommon.SpanID {
140 return pcommon.SpanID(ms.orig.SpanId)
141 }
142
143 // SetSpanID replaces the spanid associated with this LogRecord.
144 func (ms LogRecord) SetSpanID(v pcommon.SpanID) {
145 ms.state.AssertMutable()
146 ms.orig.SpanId = internal.SpanID(v)
147 }
148
149 // EventName returns the eventname associated with this LogRecord.
150 func (ms LogRecord) EventName() string {
151 return ms.orig.EventName
152 }
153
154 // SetEventName replaces the eventname associated with this LogRecord.
155 func (ms LogRecord) SetEventName(v string) {
156 ms.state.AssertMutable()
157 ms.orig.EventName = v
158 }
159
160 // CopyTo copies all properties from the current struct overriding the destination.
161 func (ms LogRecord) CopyTo(dest LogRecord) {
162 dest.state.AssertMutable()
163 internal.CopyLogRecord(dest.orig, ms.orig)
164 }