1- # Events and Logs API Interface
1+ # Logs API Interface
22
33** Status** : [ Experimental] ( ../document-status.md )
44
1414 + [ Get a Logger] ( #get-a-logger )
1515- [ Logger] ( #logger )
1616 * [ Logger operations] ( #logger-operations )
17- + [ Emit Event] ( #emit-event )
1817 + [ Emit LogRecord] ( #emit-logrecord )
1918- [ LogRecord] ( #logrecord )
2019- [ Usage] ( #usage )
2625
2726</details >
2827
29- The Events and Logs API consist of these main classes:
28+ The Logs API consist of these main classes:
3029
3130* LoggerProvider is the entry point of the API. It provides access to Loggers.
3231* 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.
3534
3635LoggerProvider/Logger are analogous to TracerProvider/Tracer.
3736
3837``` mermaid
3938graph TD
4039 A[LoggerProvider] -->|Get| B(Logger)
41- B --> C(Event)
42- B --> D(Log)
40+ B --> C(Log)
4341```
4442
4543## LoggerProvider
@@ -91,12 +89,9 @@ produced by this library.
9189the scope has a version (e.g. a library version). Example value: 1.0.0.
9290- ` schema_url ` (optional): Specifies the Schema URL that should be recorded in
9391the 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 ) .
9792- ` 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.
10095- ` attributes ` (optional): Specifies the instrumentation scope attributes to
10196associate with emitted telemetry.
10297
@@ -111,7 +106,7 @@ identifying fields are equal. The term *distinct* applied to Loggers describes
111106instances where at least one identifying field has a different value.
112107
113108Implementations 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
115110to pick up configuration changes. This can be achieved either by allowing to
116111work with an outdated configuration or by ensuring that new configuration
117112applies also to previously returned Loggers.
@@ -120,7 +115,7 @@ Note: This could, for example, be implemented by storing any mutable
120115configuration in the ` LoggerProvider ` and having ` Logger ` implementation objects
121116have a reference to the ` LoggerProvider ` from which they were obtained.
122117If 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
124119in a map in the ` LoggerProvider ` , or the ` LoggerProvider ` could maintain a registry
125120of all returned ` Logger ` s and actively update their configuration if it changes.
126121
@@ -130,7 +125,7 @@ the emitted data format is capable of representing such association.
130125
131126## Logger
132127
133- The ` Logger ` is responsible for emitting Events and Logs.
128+ The ` Logger ` is responsible for emitting ` LogRecord ` s
134129
135130Note that ` Logger ` s should not be responsible for configuration. This should be
136131the responsibility of the ` LoggerProvider ` instead.
@@ -139,24 +134,6 @@ the responsibility of the `LoggerProvider` instead.
139134
140135The Logger MUST provide functions to:
141136
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-
160137#### Emit LogRecord
161138
162139Emit a ` LogRecord ` to the processing pipeline.
@@ -173,7 +150,7 @@ by end users or other instrumentation.
173150
174151## LogRecord
175152
176- The API emits [ Events ] ( #emit-event ) and [ LogRecords] ( #emit-logrecord ) using
153+ The API emits [ LogRecords] ( #emit-logrecord ) using
177154the ` LogRecord ` [ data model] ( data-model.md ) .
178155
179156A function receiving this as an argument MUST be able to set the following
0 commit comments