Class PrettyPrintingJsonGeneratorDecorator

java.lang.Object
net.logstash.logback.decorate.PrettyPrintingJsonGeneratorDecorator
All Implemented Interfaces:
JsonGeneratorDecorator

public class PrettyPrintingJsonGeneratorDecorator extends Object implements JsonGeneratorDecorator
Enables pretty printing on the JsonGenerator
  • Constructor Details

    • PrettyPrintingJsonGeneratorDecorator

      public PrettyPrintingJsonGeneratorDecorator()
  • Method Details

    • decorate

      public JsonGenerator decorate(JsonGenerator generator)
      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 interface JsonGeneratorDecorator
      Parameters:
      generator - the generator to decorate
      Returns:
      the decorated generator
    • setRootSeparator

      public void setRootSeparator(String rootSeparator)
      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: