Class NaftahLogFormatter

java.lang.Object
java.util.logging.Formatter
org.daiitech.naftah.utils.script.NaftahLogFormatter

public class NaftahLogFormatter extends Formatter
A custom log formatter that supports reshaping text for proper visual display in logging output. If text is detected and reshaping is enabled, the formatter will reshape the text before logging it. Otherwise, the original message is logged.

Note: Actual implementations of shape(), containsArabicLetters(String), and shouldReshape() are assumed to exist elsewhere in the codebase.

Author:
Chakib Daii
  • Field Details

    • LOG_MSG

      private static final String LOG_MSG
      Template for the formatted log message. It includes the log level and the message itself.
      See Also:
  • Constructor Details

    • NaftahLogFormatter

      public NaftahLogFormatter()
  • Method Details

    • format

      public String format(LogRecord record)
      Formats a given LogRecord by checking if the message contains text. If so, and reshaping is enabled, the message will be reshaped for visual rendering. If reshaping fails or is not required, the original message is logged.
      Specified by:
      format in class Formatter
      Parameters:
      record - the log record to be formatted
      Returns:
      the formatted log message as a string