Record Class FLogger

java.lang.Object
java.lang.Record
net.flectone.pulse.logging.FLogger
Record Components:
logAdapter - hands a finished record to the platform logger
fileFacadeSupplier - supplies the config, which is not loaded yet when the logger is created

public record FLogger(LogAdapter logAdapter, Supplier<FileFacade> fileFacadeSupplier) extends Record
The plugin's logger. It writes through the platform's own logger and, where the console supports it, renders the colors a message carries.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final boolean
    Whether debug output is switched on by the system property.
    static final String
    The line asking the user to report an unexpected failure.
  • Constructor Summary

    Constructors
    Constructor
    Description
    FLogger(LogAdapter logAdapter, Supplier<FileFacade> fileFacadeSupplier)
    Creates an instance of a FLogger record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable Config.Logger
    The logger settings, or null while the config is still loading.
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns the value of the fileFacadeSupplier record component.
    final int
    Returns a hash code value for this object.
    void
    info(@NonNull String format, Object... args)
    Logs a formatted message.
    void
    info(@Nullable String string)
    Logs a message.
    void
    log(@NonNull com.alessiodp.libby.logging.LogLevel logLevel, @Nullable String string)
    Logs a message at the given level with formatting applied.
    void
    log(@NonNull com.alessiodp.libby.logging.LogLevel logLevel, @Nullable String string, @Nullable Throwable throwable)
    Logs a failure at the given level with formatting applied.
    Returns the value of the logAdapter record component.
    void
    Logs the plugin banner with its version and links.
    void
    Logs that the plugin has shut down.
    void
    Logs that the plugin is shutting down.
    void
    Logs that the plugin has started.
    void
    Logs that the plugin is starting up.
    void
    Logs that a reload has finished.
    void
    Logs that a reload has begun.
    final String
    Returns a string representation of this record class.
    void
    warning(@NonNull String format, @Nullable Throwable throwable, Object... args)
    Logs a failure with its stack trace under a formatted message.
    void
    warning(@NonNull String format, Object... args)
    Logs a formatted warning.
    void
    warning(@Nullable Object object)
    Logs a warning, rendering the value as text.
    void
    warning(@Nullable String string)
    Logs a warning.
    void
    warning(@Nullable String string, @Nullable Throwable throwable)
    Logs a failure with its stack trace under a message of your own.
    void
    warning(@Nullable Throwable throwable)
    Logs a failure with its stack trace and a request to report it.

    Methods inherited from class Object

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

    • DEBUG_ENABLED

      public static final boolean DEBUG_ENABLED
      Whether debug output is switched on by the system property.
    • ERROR_MESSAGE_REPORT

      public static final String ERROR_MESSAGE_REPORT
      The line asking the user to report an unexpected failure.
      See Also:
  • Constructor Details

    • FLogger

      public FLogger(LogAdapter logAdapter, Supplier<FileFacade> fileFacadeSupplier)
      Creates an instance of a FLogger record class.
      Parameters:
      logAdapter - the value for the logAdapter record component
      fileFacadeSupplier - the value for the fileFacadeSupplier record component
  • Method Details

    • config

      public @Nullable Config.Logger config()
      The logger settings, or null while the config is still loading.
      Returns:
      the settings, or null
    • logEnabling

      public void logEnabling()
      Logs that the plugin is starting up.
    • logEnabled

      public void logEnabled()
      Logs that the plugin has started.
    • logDisabling

      public void logDisabling()
      Logs that the plugin is shutting down.
    • logDisabled

      public void logDisabled()
      Logs that the plugin has shut down.
    • logReloading

      public void logReloading()
      Logs that a reload has begun.
    • logReloaded

      public void logReloaded()
      Logs that a reload has finished.
    • logDescription

      public void logDescription()
      Logs the plugin banner with its version and links.
    • info

      public void info(@Nullable String string)
      Logs a message.
      Parameters:
      string - the message
    • info

      public void info(@NonNull String format, Object... args)
      Logs a formatted message.
      Parameters:
      format - the format string
      args - the arguments
    • warning

      public void warning(@Nullable Object object)
      Logs a warning, rendering the value as text.
      Parameters:
      object - the value
    • warning

      public void warning(@Nullable String string)
      Logs a warning.
      Parameters:
      string - the message
    • warning

      public void warning(@NonNull String format, Object... args)
      Logs a formatted warning.
      Parameters:
      format - the format string
      args - the arguments
    • warning

      public void warning(@NonNull String format, @Nullable Throwable throwable, Object... args)
      Logs a failure with its stack trace under a formatted message.
      Parameters:
      format - the format string
      throwable - the failure
      args - the arguments
    • warning

      public void warning(@Nullable Throwable throwable)
      Logs a failure with its stack trace and a request to report it.
      Parameters:
      throwable - the failure
    • warning

      public void warning(@Nullable String string, @Nullable Throwable throwable)
      Logs a failure with its stack trace under a message of your own.
      Parameters:
      string - the message
      throwable - the failure
    • log

      public void log(@NonNull com.alessiodp.libby.logging.LogLevel logLevel, @Nullable String string)
      Logs a message at the given level with formatting applied.
      Parameters:
      logLevel - the level
      string - the message
    • log

      public void log(@NonNull com.alessiodp.libby.logging.LogLevel logLevel, @Nullable String string, @Nullable Throwable throwable)
      Logs a failure at the given level with formatting applied.
      Parameters:
      logLevel - the level
      string - the message
      throwable - the failure
    • 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.
    • logAdapter

      public LogAdapter logAdapter()
      Returns the value of the logAdapter record component.
      Returns:
      the value of the logAdapter record component
    • fileFacadeSupplier

      public Supplier<FileFacade> fileFacadeSupplier()
      Returns the value of the fileFacadeSupplier record component.
      Returns:
      the value of the fileFacadeSupplier record component