Class LogRecord

java.lang.Object
codes.grow.packages.skywalking.logging.LogRecord
All Implemented Interfaces:
LogEntry

public final class LogRecord extends Object implements 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).

  • Method Details

    • builder

      public static LogRecord.Builder builder()
      Returns a new builder.
      Returns:
      builder with severity INFO and an empty body
    • toBuilder

      public LogRecord.Builder toBuilder()
      Returns a builder initialised with this record's values.
      Returns:
      a builder copy
    • timestamp

      public Instant timestamp()
      Event time.
      Returns:
      the timestamp (Instant.EPOCH when never set)
    • observedTimestamp

      public Optional<Instant> observedTimestamp()
      Time the SDK observed the record.
      Returns:
      observed timestamp, if set
    • severity

      public Severity severity()
      Severity.
      Returns:
      severity
    • severityText

      public String severityText()
      Severity text ("TRACE"…"FATAL" or the vendor text).
      Returns:
      severity text
    • body

      public String body()
      Message; structured bodies are JSON-encoded strings.
      Returns:
      body
    • attributes

      public Map<String,Object> attributes()
      Attributes.
      Returns:
      immutable attribute map
    • resource

      public Map<String,Object> resource()
      Resource attributes (service.name, service.version, …).
      Returns:
      immutable resource map
    • traceId

      public Optional<String> traceId()
      Trace id (32 lower-hex).
      Returns:
      trace id, if set
    • spanId

      public Optional<String> spanId()
      Span id (16 lower-hex).
      Returns:
      span id, if set
    • traceFlags

      public OptionalInt traceFlags()
      W3C trace flags.
      Returns:
      trace flags, if set
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Returns the normalized JSON form (see LogRecordJson).
      Overrides:
      toString in class Object