Record Class PlainLogger

java.lang.Object
java.lang.Record
de.craftsblock.craftsnet.logging.impl.PlainLogger
All Implemented Interfaces:
Logger

public record PlainLogger(Logger previous) extends Record implements Logger
An implementation of the Logger interface that prints the result in the System.out or the System.err stream, without any further formating.
Since:
3.1.0-SNAPSHOT
  • Constructor Details

    • PlainLogger

      public PlainLogger(Logger previous)
      Constructs an PlainLogger with a reference to a previous Logger.
      Parameters:
      previous - the previous Logger in the chain, can be used for chaining or fallback purposes.
  • Method Details

    • previous

      public Logger previous()
      Returns the previous Logger in the chain. This can be used to access the logger that was previously used before this PlainLogger.
      Returns:
      The previous Logger instance.
    • info

      public void info(@Nullable @Nullable String text)
      Logs an informational message.
      Specified by:
      info in interface Logger
      Parameters:
      text - The text of the informational message to log. It can be null.
    • warning

      public void warning(@Nullable @Nullable String text)
      Logs a warning message.
      Specified by:
      warning in interface Logger
      Parameters:
      text - The text of the warning message to log. It can be null.
    • error

      public void error(@Nullable @Nullable String text)
      Logs an error message.
      Specified by:
      error in interface Logger
      Parameters:
      text - The text of the error message to log. It can be null.
    • error

      public void error(@NotNull @NotNull Throwable throwable)
      Logs an error message along with the associated throwable.
      Specified by:
      error in interface Logger
      Parameters:
      throwable - The Throwable object representing the error. Must not be null.
    • error

      public void error(@Nullable @Nullable String message, @NotNull @NotNull Throwable throwable)
      Logs an error message along with the associated throwable.
      Specified by:
      error in interface Logger
      Parameters:
      message - A descriptive message for the error. It can be null.
      throwable - The Throwable object representing the error. Must not be null.
      Since:
      3.5.2
    • debug

      public void debug(@Nullable @Nullable String text)
      Logs a debug message.
      Specified by:
      debug in interface Logger
      Parameters:
      text - The text of the debug message to log. It can be null.
    • cloneWithName

      public Logger cloneWithName(String name)
      Creates a clone of this Logger with a specified name.
      Specified by:
      cloneWithName in interface Logger
      Parameters:
      name - The name for the cloned logger. (Not used in any way!)
      Returns:
      A new Logger instance cloned from this logger with the given name.
    • 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.