Class LoggerMessageFormat

java.lang.Object
org.opensearch.core.common.logging.LoggerMessageFormat

public class LoggerMessageFormat extends Object
Format string for OpenSearch log messages.

This class is almost a copy of org.slf4j.helpers.MessageFormatter

The original code is licensed under the MIT License and is available at : MessageFormatter.java

Opensearch.internal:
  • Constructor Details

    • LoggerMessageFormat

      public LoggerMessageFormat()
  • Method Details

    • format

      public static String format(String messagePattern, Object... argArray)
    • format

      public static String format(String prefix, String messagePattern, Object... argArray)
      (this is almost a copy of org.slf4j.helpers.MessageFormatter.arrayFormat)
      Parameters:
      prefix - the prefix to prepend to the formatted message (can be null)
      messagePattern - the message pattern which will be parsed and formatted
      argArray - an array of arguments to be substituted in place of formatting anchors
      Returns:
      null if messagePattern is null

      messagePattern if argArray is (null or empty) and prefix is null

      prefix + messagePattern if argArray is (null or empty) and prefix is not null

      formatted message otherwise (even if prefix is null)