LogFields
classin packageklyn.logging
public final class LogFields:
LogFields

Immutable snapshot of structured fields attached to a log event.

Input maps are copied on construction and toMap() returns another copy, so field membership cannot be changed through an emitted event. Referenced object values retain their own mutability semantics.

Example
import klyn.logging

fields = LogFields({"requestId": "req-42"})
assert fields["requestId"] == "req-42"
Properties
Modifier and Type Member Description
public readonly property size
size as ULong:
Number of structured fields.
Constructors
Modifier and Type Member Description
public LogFields
LogFields(values as Map<String, Object> = null):
Creates an immutable field snapshot.
Methods
Modifier and Type Member Description
public items
items() as IList<Tuple<String, Object> >:
Returns an immutable snapshot of field entries.
public keys
keys() as IList<String>:
Returns field names.
public static merge
merge( context as Map<String, Object>, explicitFields as Map<String, Object> ) as LogFields:
Merges two maps, giving explicit fields precedence over context fields.
public toMap
toMap() as SortedMap<String, Object>:
Returns a mutable copy of the fields.
public override toString
toString() as String:
Returns a readable map representation.
Operators
Modifier and Type Member Description
public operator in(name as String) as Boolean: Tests whether a field exists.
public operator[](name as String) as Object: Reads a field.