Interface LogRecordBuilder
Logger
.
Obtain a Logger.logRecordBuilder()
, add properties using the setters, and emit the log
record by calling emit()
.
- Since:
- 1.27.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
emit()
Emit the log record.default LogRecordBuilder
setAllAttributes
(Attributes attributes) Sets attributes.<T> LogRecordBuilder
setAttribute
(AttributeKey<T> key, T value) Sets an attribute.Set the body string.setContext
(io.opentelemetry.context.Context context) Set the context.setObservedTimestamp
(long timestamp, TimeUnit unit) Set the epochobservedTimestamp
, using the timestamp and unit.setObservedTimestamp
(Instant instant) Set theobservedTimestamp
, using the instant.setSeverity
(Severity severity) Set the severity.setSeverityText
(String severityText) Set the severity text.setTimestamp
(long timestamp, TimeUnit unit) Set the epochtimestamp
, using the timestamp and unit.setTimestamp
(Instant instant) Set the epochtimestamp
, using the instant.
-
Method Details
-
setTimestamp
Set the epochtimestamp
, using the timestamp and unit.The
timestamp
is the time at which the log record occurred. If unset, it will be set to the current time whenemit()
is called. -
setTimestamp
Set the epochtimestamp
, using the instant.The
timestamp
is the time at which the log record occurred. If unset, it will be set to the current time whenemit()
is called. -
setObservedTimestamp
Set the epochobservedTimestamp
, using the timestamp and unit.The
observedTimestamp
is the time at which the log record was observed. If unset, it will be set to thetimestamp
.observedTimestamp
may be different fromtimestamp
if logs are being processed asynchronously (e.g. from a file or on a different thread). -
setObservedTimestamp
Set theobservedTimestamp
, using the instant.The
observedTimestamp
is the time at which the log record was observed. If unset, it will be set to thetimestamp
.observedTimestamp
may be different fromtimestamp
if logs are being processed asynchronously (e.g. from a file or on a different thread). -
setContext
Set the context. -
setSeverity
Set the severity. -
setSeverityText
Set the severity text. -
setBody
Set the body string. -
setAllAttributes
Sets attributes. If theLogRecordBuilder
previously contained a mapping for any of the keys, the old values are replaced by the specified values. -
setAttribute
Sets an attribute. -
emit
void emit()Emit the log record.
-