Class LogRecord
java.lang.Object
codes.grow.packages.betterstack.logging.LogRecord
- All Implemented Interfaces:
LogEntry
One immutable log record in the normalized SDK form (OpenTelemetry log data model).
Attribute and resource values are attribute values as described in AttrValues. Trace
and span ids are lower-case hex (32 and 16 characters).
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionAttributes.body()Message; structured bodies are JSON-encoded strings.static LogRecord.Builderbuilder()Returns a new builder.booleaninthashCode()Time the SDK observed the record.resource()Resource attributes (service.name,service.version, …).severity()Severity.Severity text ("TRACE"…"FATAL"or the vendor text).spanId()Span id (16 lower-hex).Event time.Returns a builder initialised with this record's values.toString()Returns the normalized JSON form (seeLogRecordJson).W3C trace flags.traceId()Trace id (32 lower-hex).
-
Method Details
-
builder
Returns a new builder.- Returns:
- builder with severity INFO and an empty body
-
toBuilder
Returns a builder initialised with this record's values.- Returns:
- a builder copy
-
timestamp
Event time.- Returns:
- the timestamp (
Instant.EPOCHwhen never set)
-
observedTimestamp
Time the SDK observed the record.- Returns:
- observed timestamp, if set
-
severity
Severity.- Returns:
- severity
-
severityText
Severity text ("TRACE"…"FATAL"or the vendor text).- Returns:
- severity text
-
body
Message; structured bodies are JSON-encoded strings.- Returns:
- body
-
attributes
Attributes.- Returns:
- immutable attribute map
-
resource
Resource attributes (service.name,service.version, …).- Returns:
- immutable resource map
-
traceId
Trace id (32 lower-hex).- Returns:
- trace id, if set
-
spanId
Span id (16 lower-hex).- Returns:
- span id, if set
-
traceFlags
W3C trace flags.- Returns:
- trace flags, if set
-
equals
-
hashCode
public int hashCode() -
toString
Returns the normalized JSON form (seeLogRecordJson).
-