Record Class ExtensionLogger

java.lang.Object
java.lang.Record
com.booksaw.betterTeams.extension.ExtensionLogger
Record Components:
logger - The underlying Logger instance
prefix - The formatted prefix

public record ExtensionLogger(Logger logger, String prefix) extends Record
A simple logger wrapper that prepends a fixed, formatted prefix This utility ensures that all output from a specific extension is clearly identifiable in the server console.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ExtensionLogger(@NotNull Logger logger, @NotNull String prefix)
    Creates an instance of a ExtensionLogger record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    void
    info(@NotNull String msg)
    Logs an INFO message.
    void
    log(@NotNull Level level, @NotNull String msg)
    Logs a message at the specified level.
    void
    log(@NotNull Level level, @NotNull String msg, @NotNull Throwable thrown)
    Logs a message at the specified level with an associated exception.
    Returns the value of the logger record component.
    Returns the value of the prefix record component.
    void
    severe(@NotNull String msg)
    Logs an SEVERE message.
    final String
    Returns a string representation of this record class.
    void
    warning(@NotNull String msg)
    Logs an WARNING message.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ExtensionLogger

      public ExtensionLogger(@NotNull @NotNull Logger logger, @NotNull @NotNull String prefix)
      Creates an instance of a ExtensionLogger record class.
      Parameters:
      logger - the value for the logger record component
      prefix - the value for the prefix record component
  • Method Details

    • info

      public void info(@NotNull @NotNull String msg)
      Logs an INFO message.
      Parameters:
      msg - The message to log.
    • warning

      public void warning(@NotNull @NotNull String msg)
      Logs an WARNING message.
      Parameters:
      msg - The message to log.
    • severe

      public void severe(@NotNull @NotNull String msg)
      Logs an SEVERE message.
      Parameters:
      msg - The message to log.
    • log

      public void log(@NotNull @NotNull Level level, @NotNull @NotNull String msg)
      Logs a message at the specified level.
      Parameters:
      level - The log level (e.g., Level.INFO).
      msg - The message to log.
    • log

      public void log(@NotNull @NotNull Level level, @NotNull @NotNull String msg, @NotNull @NotNull Throwable thrown)
      Logs a message at the specified level with an associated exception.
      Parameters:
      level - The log level (e.g., Level.SEVERE).
      msg - The message to log.
      thrown - The Throwable to log.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • logger

      public Logger logger()
      Returns the value of the logger record component.
      Returns:
      the value of the logger record component
    • prefix

      public String prefix()
      Returns the value of the prefix record component.
      Returns:
      the value of the prefix record component