Class JsonAppender

java.lang.Object
de.oliver.fancyanalytics.logger.appender.JsonAppender
All Implemented Interfaces:
Appender

public class JsonAppender extends Object implements Appender
  • Constructor Summary

    Constructors
    Constructor
    Description
    JsonAppender(boolean prettyPrint, boolean printToConsole, boolean printToFile, String filePath)
    Constructs a JsonAppender that can output log entries in JSON format with various configurations.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    append(LogEntry logEntry)
    Appends a log entry to the designated output.
    void
    Closes the appender and releases any resources associated with it.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JsonAppender

      public JsonAppender(boolean prettyPrint, boolean printToConsole, boolean printToFile, String filePath)
      Constructs a JsonAppender that can output log entries in JSON format with various configurations.
      Parameters:
      prettyPrint - If true, the JSON output will be pretty-printed.
      printToConsole - If true, the JSON output will be printed to the console.
      printToFile - If true, the JSON output will be printed to a file.
      filePath - The file path where the JSON output will be written if printToFile is true.
  • Method Details

    • append

      public void append(LogEntry logEntry)
      Description copied from interface: Appender
      Appends a log entry to the designated output.
      Specified by:
      append in interface Appender
      Parameters:
      logEntry - The log entry containing details about the log message.
    • close

      public void close()
      Description copied from interface: Appender
      Closes the appender and releases any resources associated with it. This method should be called when the appender is no longer needed to ensure that all underlying resources are properly disposed of.
      Specified by:
      close in interface Appender