LogRecordBuilder

zio.blocks.telemetry.LogRecordBuilder
final case class LogRecordBuilder(timestampNanos: Option[Long] = ..., observedTimestampNanos: Option[Long] = ..., severity: Severity = ..., body: LogMessage = ..., attributes: Attributes = ..., traceIdHi: Long = ..., traceIdLo: Long = ..., spanId: Long = ..., traceFlags: Byte = ..., resource: Resource = ..., instrumentationScope: InstrumentationScope = ...)

Immutable builder for constructing LogRecord instances with fluent API.

The builder provides sensible defaults for all fields:

  • timestamps default to current system time in nanoseconds
  • severity defaults to Info
  • severityText defaults to "INFO"
  • body defaults to empty string
  • attributes defaults to empty Attributes
  • trace fields default to 0 (absent)
  • resource defaults to Resource.empty
  • instrumentationScope defaults to InstrumentationScope with name "unknown"

Attributes

Source
LogRecord.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

Builds the final LogRecord.

Builds the final LogRecord.

Uses current system time for any timestamps not explicitly set.

Attributes

Source
LogRecord.scala
def setAttribute[A](key: AttributeKey[A], value: A): LogRecordBuilder

Adds an attribute to the log record.

Adds an attribute to the log record.

Attributes

Source
LogRecord.scala
def setBody(msg: String): LogRecordBuilder

Sets the log message body.

Sets the log message body.

Attributes

Source
LogRecord.scala

Sets the log message body from a LogMessage.

Sets the log message body from a LogMessage.

Attributes

Source
LogRecord.scala

Sets the instrumentation scope.

Sets the instrumentation scope.

Attributes

Source
LogRecord.scala

Sets the observed timestamp (time when the event was recorded).

Sets the observed timestamp (time when the event was recorded).

Attributes

Source
LogRecord.scala

Sets the resource that generated this log record.

Sets the resource that generated this log record.

Attributes

Source
LogRecord.scala

Sets the severity level of the log record.

Sets the severity level of the log record.

Attributes

Source
LogRecord.scala
def setSpanId(id: Long): LogRecordBuilder

Sets the span ID for correlation with distributed traces.

Sets the span ID for correlation with distributed traces.

Attributes

Source
LogRecord.scala
def setTimestamp(nanos: Long): LogRecordBuilder

Sets the timestamp (time when the event occurred).

Sets the timestamp (time when the event occurred).

Attributes

Source
LogRecord.scala
def setTraceFlags(flags: Byte): LogRecordBuilder

Sets the trace flags (e.g., sampled flag).

Sets the trace flags (e.g., sampled flag).

Attributes

Source
LogRecord.scala
def setTraceId(hi: Long, lo: Long): LogRecordBuilder

Sets the trace ID for correlation with distributed traces.

Sets the trace ID for correlation with distributed traces.

Attributes

Source
LogRecord.scala

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
Source
Product.scala
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
Source
Product.scala