Tags
Immutable tags which can be attached to log statements via platform specific injection mechanisms.
A tag is either a "simple" tag, added via addTag or a tag with a value, added via one of the addTag(name,value) methods. When thinking of tags as a
Map<String, Set<Object>>, the value of a "simple" tag is the empty set.
Tag values can be of several simple types and are held in a stable, sorted order within a Tags instance. In other words it never matters in which order two Tags instances are merged.
When tags are merged, the result is the union of the values. This is easier to explain When thinking of tags as a Map<String, Set<Object>>, where "merging" means taking the union of the Set associated with the tag name. In particular, for a given tag name:
- Adding the same value for a given tag twice has no additional effect.
- Adding a simple tag twice has no additional effect.
- Adding a tag with a value is also implicitly like adding a simple tag with the same name.
The toString implementation of this class provides a human readable, machine parsable representation of the tags.