Class LogField

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class LogField extends ProxyInstance

Structure representing a single field in a structured log entry. See g_log_structured() for details.

Log fields may contain arbitrary values, including binary with embedded nul bytes. If the field contains a string, the string must be UTF-8 encoded and have a trailing nul byte. Otherwise, length must be set to a non-negative value.

Since:
2.50
  • Constructor Details

    • LogField

      public LogField(MemorySegment address)
      Create a LogField proxy instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • LogField

      public LogField(Arena arena)
      Allocate a new LogField.
      Parameters:
      arena - to control the memory allocation scope
    • LogField

      public LogField()
      Allocate a new LogField. The memory is allocated with Arena.ofAuto().
    • LogField

      public LogField(String key, MemorySegment value, long length, Arena arena)
      Allocate a new LogField with the fields set to the provided values.
      Parameters:
      key - value for the field key
      value - value for the field value
      length - value for the field length
      arena - to control the memory allocation scope
    • LogField

      public LogField(String key, MemorySegment value, long length)
      Allocate a new LogField with the fields set to the provided values. The memory is allocated with Arena.ofAuto().
      Parameters:
      key - value for the field key
      value - value for the field value
      length - value for the field length
  • Method Details

    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • readKey

      public String readKey()
      Read the value of the field key.
      Returns:
      The value of the field key
    • writeKey

      public void writeKey(String key, Arena _arena)
      Write a value in the field key.
      Parameters:
      key - The new value for the field key
      _arena - to control the memory allocation scope
    • readValue

      public MemorySegment readValue()
      Read the value of the field value.
      Returns:
      The value of the field value
    • writeValue

      public void writeValue(MemorySegment value)
      Write a value in the field value.
      Parameters:
      value - The new value for the field value
    • readLength

      public long readLength()
      Read the value of the field length.
      Returns:
      The value of the field length
    • writeLength

      public void writeLength(long length)
      Write a value in the field length.
      Parameters:
      length - The new value for the field length