Class CSVFormatter

java.lang.Object
java.util.logging.Formatter
de.aristaflow.adept2.base.registry.CSVFormatter

public class CSVFormatter extends Formatter
This class formats a LogRecord to a CSV-record as specified in RFC 4180. Most of the fields of a record will be AristaFlow-specific (template ID, instance ID, information on the session token, ...) if provided by the log record.
  • Constructor Details

    • CSVFormatter

      public CSVFormatter()
      Creates a new formatter for CSV.
  • Method Details

    • format

      public String format(LogRecord record)
      Specified by:
      format in class Formatter
    • getHead

      public String getHead(Handler h)
      Gets the header line containing the names of the fields of a record as needed for a CSV.
      Overrides:
      getHead in class Formatter
    • escape

      protected String escape(String string)
      Checks whether the designated string contains control characters (field or record separators) and escapes them if required.
      Parameters:
      string - The string to check for required escaping.
      Returns:
      The designated string with the corresponding characters escaped if required.
    • escapeRequired

      protected boolean escapeRequired(String string)
      Gets whether the designated string contains control characters (field or record separators) and therefore needs escaping.
      Parameters:
      string - The string to check for required escaping.
      Returns:
      Whether the designated string contains control characters (field or record separators) and therefore needs escaping.
    • escapedString

      protected String escapedString(String string)
      Escapes all control characters in the designated string and encloses the string with the corresponding characters.
      Parameters:
      string - The string to enclose within the corresponding characters and to escape the used control characters.
      Returns:
      The designated string enclosed and having the appropriate characters escaped.