Module org.jboss.logmanager
Package org.jboss.logmanager.formatters
Interface StructuredFormatter.Generator
-
- Enclosing class:
- StructuredFormatter
protected static interface StructuredFormatter.GeneratorA generator used to create the structured output.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default StructuredFormatter.Generatoradd(String key, int value)Writes an integer value.default StructuredFormatter.Generatoradd(String key, long value)Writes a long value.StructuredFormatter.Generatoradd(String key, String value)Writes a string value.StructuredFormatter.Generatoradd(String key, Map<String,?> value)Writes a map valuedefault StructuredFormatter.GeneratoraddAttribute(String name, int value)Writes an attribute.default StructuredFormatter.GeneratoraddAttribute(String name, String value)Writes an attribute.default StructuredFormatter.GeneratoraddMetaData(Map<String,String> metaData)Adds the meta data to the structured format.default StructuredFormatter.Generatorbegin()Initial method invoked at the start of the generation.StructuredFormatter.Generatorend()Writes any trailing data that's needed.default StructuredFormatter.GeneratorendArray()Writes an end for an array.StructuredFormatter.GeneratorendObject()Writes an end to the object.default StructuredFormatter.GeneratorstartArray(String key)Writes the start of an array.StructuredFormatter.GeneratorstartObject(String key)Writes the start of an object.default booleanwrapArrays()Indicates whether or not elements in an array should be wrapped or not.
-
-
-
Method Detail
-
begin
default StructuredFormatter.Generator begin() throws Exception
Initial method invoked at the start of the generation.- Returns:
- the generator
- Throws:
Exception- if an error occurs while adding the data
-
add
default StructuredFormatter.Generator add(String key, int value) throws Exception
Writes an integer value.- Parameters:
key- they keyvalue- the value- Returns:
- the generator
- Throws:
Exception- if an error occurs while adding the data
-
add
default StructuredFormatter.Generator add(String key, long value) throws Exception
Writes a long value.- Parameters:
key- they keyvalue- the value- Returns:
- the generator
- Throws:
Exception- if an error occurs while adding the data
-
add
StructuredFormatter.Generator add(String key, Map<String,?> value) throws Exception
Writes a map value- Parameters:
key- the key for the mapvalue- the map- Returns:
- the generator
- Throws:
Exception- if an error occurs while adding the data
-
add
StructuredFormatter.Generator add(String key, String value) throws Exception
Writes a string value.- Parameters:
key- the key for the valuevalue- the string value- Returns:
- the generator
- Throws:
Exception- if an error occurs while adding the data
-
addMetaData
default StructuredFormatter.Generator addMetaData(Map<String,String> metaData) throws Exception
Adds the meta data to the structured format.By default this processes the map and uses
add(String, String)to add entries.- Parameters:
metaData- the map of the meta data, cannot benull- Returns:
- the generator
- Throws:
Exception- if an error occurs while adding the data
-
startObject
StructuredFormatter.Generator startObject(String key) throws Exception
Writes the start of an object.If the
wrapArrays()returnsfalsethe key may benulland implementations should handle this.- Parameters:
key- they key for the object, ornullif this object was started in an array and thewrapArrays()isfalse- Returns:
- the generator
- Throws:
Exception- if an error occurs while adding the data
-
endObject
StructuredFormatter.Generator endObject() throws Exception
Writes an end to the object.- Returns:
- the generator
- Throws:
Exception- if an error occurs while adding the data
-
startArray
default StructuredFormatter.Generator startArray(String key) throws Exception
Writes the start of an array. This defaults tostartObject(String)for convenience of generators that don't have a specific type for arrays.- Parameters:
key- they key for the array- Returns:
- the generator
- Throws:
Exception- if an error occurs while adding the data
-
endArray
default StructuredFormatter.Generator endArray() throws Exception
Writes an end for an array. This defaults toendObject()for convenience of generators that don't have a specific type for arrays.- Returns:
- the generator
- Throws:
Exception- if an error occurs while adding the data
-
addAttribute
default StructuredFormatter.Generator addAttribute(String name, int value) throws Exception
Writes an attribute.By default this uses the
add(String, int)method to add the attribute. If a formatter requires special handling for attributes, for example an attribute on an XML element, this method can be overridden.- Parameters:
name- the name of the attributevalue- the value of the attribute- Returns:
- the generator
- Throws:
Exception- if an error occurs while adding the data
-
addAttribute
default StructuredFormatter.Generator addAttribute(String name, String value) throws Exception
Writes an attribute.By default this uses the
add(String, String)method to add the attribute. If a formatter requires special handling for attributes, for example an attribute on an XML element, this method can be overridden.- Parameters:
name- the name of the attributevalue- the value of the attribute- Returns:
- the generator
- Throws:
Exception- if an error occurs while adding the data
-
end
StructuredFormatter.Generator end() throws Exception
Writes any trailing data that's needed.- Returns:
- the generator
- Throws:
Exception- if an error occurs while adding the data during the build
-
wrapArrays
default boolean wrapArrays()
Indicates whether or not elements in an array should be wrapped or not. The default isfalse.- Returns:
trueif elements should be wrapped, otherwisefalse
-
-