Class AgentFormatter

java.lang.Object
java.util.logging.Formatter
madkit.logging.AgentFormatter
Direct Known Subclasses:
AgentFileFormatter

public class AgentFormatter extends Formatter
This class extends the Formatter class to provide a custom log formatter for agents. It formats log records based on their level and includes a header with the logger name.
See Also:
  • Constructor Details

    • AgentFormatter

      public AgentFormatter()
  • Method Details

    • format

      public String format(LogRecord record)
      Formats the given log record. If the log level is AgentLogger.TALK, only the message is returned. Otherwise, a formatted string with the log level and message is returned.
      Specified by:
      format in class Formatter
      Parameters:
      record - the log record to be formatted
      Returns:
      the formatted log record as a string
    • getHeader

      protected StringBuilder getHeader(LogRecord record)
      Returns a StringBuilder containing the logger name as the header for the log record.
      Parameters:
      record - the log record for which the header is to be returned
      Returns:
      a StringBuilder containing the logger name