1
- # Events and Logs API Interface
1
+ # Logs API Interface
2
2
3
3
** Status** : [ Experimental] ( ../document-status.md )
4
4
14
14
+ [ Get a Logger] ( #get-a-logger )
15
15
- [ Logger] ( #logger )
16
16
* [ Logger operations] ( #logger-operations )
17
- + [ Emit Event] ( #emit-event )
18
17
+ [ Emit LogRecord] ( #emit-logrecord )
19
18
- [ LogRecord] ( #logrecord )
20
19
- [ Usage] ( #usage )
26
25
27
26
</details >
28
27
29
- The Events and Logs API consist of these main classes:
28
+ The Logs API consist of these main classes:
30
29
31
30
* LoggerProvider is the entry point of the API. It provides access to Loggers.
32
31
* Logger is the class responsible for
33
- creating [ Events ] ( ./semantic_conventions/events .md )
34
- and [ Logs ] ( ./data-model.md#log-and-event-record-definition ) as LogRecords.
32
+ emitting [ Logs ] ( ./data-model .md#log-and-event-record-definition ) as
33
+ LogRecords.
35
34
36
35
LoggerProvider/Logger are analogous to TracerProvider/Tracer.
37
36
38
37
``` mermaid
39
38
graph TD
40
39
A[LoggerProvider] -->|Get| B(Logger)
41
- B --> C(Event)
42
- B --> D(Log)
40
+ B --> C(Log)
43
41
```
44
42
45
43
## LoggerProvider
@@ -91,12 +89,9 @@ produced by this library.
91
89
the scope has a version (e.g. a library version). Example value: 1.0.0.
92
90
- ` schema_url ` (optional): Specifies the Schema URL that should be recorded in
93
91
the emitted telemetry.
94
- - ` event_domain ` (optional): Specifies the domain for the Events emitted, which
95
- MUST be added as an attribute with the key ` event.domain `
96
- to [ emitted Events] ( #emit-event ) .
97
92
- ` include_trace_context ` (optional): Specifies whether the Trace Context should
98
- automatically be passed on to the Events and Logs emitted by the Logger. This
99
- SHOULD be true by default.
93
+ automatically be passed on to the LogRecords emitted by the Logger. This
94
+ SHOULD be true by default.
100
95
- ` attributes ` (optional): Specifies the instrumentation scope attributes to
101
96
associate with emitted telemetry.
102
97
@@ -111,7 +106,7 @@ identifying fields are equal. The term *distinct* applied to Loggers describes
111
106
instances where at least one identifying field has a different value.
112
107
113
108
Implementations MUST NOT require users to repeatedly obtain a Logger again with
114
- the same name+version+schema_url+event_domain+ include_trace_context+attributes
109
+ the same name+version+schema_url+include_trace_context+attributes
115
110
to pick up configuration changes. This can be achieved either by allowing to
116
111
work with an outdated configuration or by ensuring that new configuration
117
112
applies also to previously returned Loggers.
@@ -120,7 +115,7 @@ Note: This could, for example, be implemented by storing any mutable
120
115
configuration in the ` LoggerProvider ` and having ` Logger ` implementation objects
121
116
have a reference to the ` LoggerProvider ` from which they were obtained.
122
117
If configuration must be stored per-Logger (such as disabling a certain ` Logger ` ),
123
- the ` Logger ` could, for example, do a look-up with its name+version+schema_url+event_domain+ include_trace_context+attributes
118
+ the ` Logger ` could, for example, do a look-up with its name+version+schema_url+include_trace_context+attributes
124
119
in a map in the ` LoggerProvider ` , or the ` LoggerProvider ` could maintain a registry
125
120
of all returned ` Logger ` s and actively update their configuration if it changes.
126
121
@@ -130,7 +125,7 @@ the emitted data format is capable of representing such association.
130
125
131
126
## Logger
132
127
133
- The ` Logger ` is responsible for emitting Events and Logs.
128
+ The ` Logger ` is responsible for emitting ` LogRecord ` s
134
129
135
130
Note that ` Logger ` s should not be responsible for configuration. This should be
136
131
the responsibility of the ` LoggerProvider ` instead.
@@ -139,24 +134,6 @@ the responsibility of the `LoggerProvider` instead.
139
134
140
135
The Logger MUST provide functions to:
141
136
142
- #### Emit Event
143
-
144
- Emit a ` LogRecord ` representing an Event to the processing pipeline.
145
-
146
- This function MAY be named ` logEvent ` .
147
-
148
- ** Parameters:**
149
-
150
- * ` name ` - the Event name. This argument MUST be recorded as a ` LogRecord `
151
- attribute with the key ` event.name ` . Care MUST be taken by the implementation
152
- to not override or delete this attribute while the Event is emitted to
153
- preserve its identity.
154
- * ` logRecord ` - the [ LogRecord] ( #logrecord ) representing the Event.
155
-
156
- Events require the ` event.domain ` attribute. The API MUST not allow creating an
157
- Event if ` event_domain ` was not specified when
158
- the [ Logger was obtained] ( #get-a-logger ) .
159
-
160
137
#### Emit LogRecord
161
138
162
139
Emit a ` LogRecord ` to the processing pipeline.
@@ -173,7 +150,7 @@ by end users or other instrumentation.
173
150
174
151
## LogRecord
175
152
176
- The API emits [ Events ] ( #emit-event ) and [ LogRecords] ( #emit-logrecord ) using
153
+ The API emits [ LogRecords] ( #emit-logrecord ) using
177
154
the ` LogRecord ` [ data model] ( data-model.md ) .
178
155
179
156
A function receiving this as an argument MUST be able to set the following
0 commit comments