Class PrettyPrintingDecorator<M extends ObjectMapper, B extends MapperBuilder<M,B> >
java.lang.Object
net.logstash.logback.decorate.PrettyPrintingDecorator<M,B>
- All Implemented Interfaces:
Decorator<B>, MapperBuilderDecorator<M,B>
public class PrettyPrintingDecorator<M extends ObjectMapper, B extends MapperBuilder<M,B>>
extends Object
implements MapperBuilderDecorator<M,B>
Enables pretty printing on a
MapperBuilder.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDecorates the givendecoratable.voidsetIndentArraysWithNewLine(boolean indentArraysWithNewLine) Sets whether arrays are indented with a new line.voidsetRootSeparator(String rootSeparator) Sets the root separator used by the pretty printer.voidsetSpacesInObjectEntries(boolean spacesInObjectEntries) Sets whether spaces appear in object entries.
-
Constructor Details
-
PrettyPrintingDecorator
public PrettyPrintingDecorator()
-
-
Method Details
-
decorate
Description copied from interface:DecoratorDecorates the givendecoratable.- Specified by:
decoratein interfaceDecorator<M extends ObjectMapper>- Parameters:
mapperBuilder- the object to decorate- Returns:
- the decorated object (can be a different from the object passed in as an arg)
-
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:
-
setIndentArraysWithNewLine
public void setIndentArraysWithNewLine(boolean indentArraysWithNewLine) Sets whether arrays are indented with a new line.- Parameters:
indentArraysWithNewLine- whether arrays are indented with a new line.
-