Record Class NoOpLogger

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

public record NoOpLogger(Logger previous) extends Record implements Logger
An implementation of the Logger interface that performs no operations. The NoOpLogger simply accepts log messages and errors but does not process them in any way.
Since:
3.4.0-SNAPSHOT
  • Constructor Details

    • NoOpLogger

      public NoOpLogger(Logger previous)
      Constructs an NoOpLogger 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

    • info

      public void info(@Nullable @Nullable String text)
      Logs an informational message. This implementation does nothing.
      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. This implementation does nothing.
      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. This implementation does nothing.
      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. This implementation does nothing.
      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. This implementation does nothing.
      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.
    • debug

      public void debug(@Nullable @Nullable String text)
      Logs a debug message. This implementation does nothing.
      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.
    • format

      public String format(@NotNull @NotNull String format, Object... args)
      Utility method for formatting a string with arguments.

      This method just returns the unformatted format as this logger has no actions.

      Specified by:
      format in interface Logger
      Parameters:
      format - The format string. Must not be null.
      args - Arguments referenced by the format specifiers in the format string.
      Returns:
      A formatted string.
      Since:
      3.5.2
    • 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.
    • previous

      public Logger previous()
      Returns the value of the previous record component.
      Returns:
      the value of the previous record component