Package net.logstash.logback.decorate
Class PrettyPrintingJsonGeneratorDecorator
java.lang.Object
net.logstash.logback.decorate.PrettyPrintingJsonGeneratorDecorator
- All Implemented Interfaces:
JsonGeneratorDecorator
Enables pretty printing on the
JsonGenerator
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondecorate
(JsonGenerator generator) Decorates the given generator, and returns the decorated generator.void
setRootSeparator
(String rootSeparator) Sets the root separator used by the pretty printer.void
setSpacesInObjectEntries
(boolean spacesInObjectEntries) Sets whether spaces appear in object entries.
-
Constructor Details
-
PrettyPrintingJsonGeneratorDecorator
public PrettyPrintingJsonGeneratorDecorator()
-
-
Method Details
-
decorate
Description copied from interface:JsonGeneratorDecorator
Decorates the given generator, and returns the decorated generator.The returned decorator does not need to be the same object as the given generator.
- Specified by:
decorate
in interfaceJsonGeneratorDecorator
- Parameters:
generator
- the generator to decorate- Returns:
- the decorated generator
-
setRootSeparator
Sets the root separator used by the pretty printer.Replaces occurrences of the string literal
[SPACE]
with a space character to work around the fact that logback trims values read from xml before calling the setter. Therefore, to set the root separator to a single space, you can specify<rootSeparator>[SPACE]</rootSeparator>
in the xml configuration.- Parameters:
rootSeparator
- the new root separator- See Also:
-
setSpacesInObjectEntries
public void setSpacesInObjectEntries(boolean spacesInObjectEntries) Sets whether spaces appear in object entries.- Parameters:
spacesInObjectEntries
- whether spaces appear in object entries.- See Also:
-