Class HytaleLoggerBackend

java.lang.Object
com.google.common.flogger.backend.LoggerBackend
com.hypixel.hytale.logger.backend.HytaleLoggerBackend

public class HytaleLoggerBackend extends com.google.common.flogger.backend.LoggerBackend
  • Field Details

  • Method Details

    • getLoggerName

      public String getLoggerName()
      Specified by:
      getLoggerName in class com.google.common.flogger.backend.LoggerBackend
    • getLevel

      @Nonnull public Level getLevel()
    • isLoggable

      public boolean isLoggable(@Nonnull Level lvl)
      Specified by:
      isLoggable in class com.google.common.flogger.backend.LoggerBackend
    • log

      public void log(@Nonnull com.google.common.flogger.backend.LogData data)
      Specified by:
      log in class com.google.common.flogger.backend.LoggerBackend
    • handleError

      public void handleError(@Nonnull RuntimeException error, @Nonnull com.google.common.flogger.backend.LogData badData)
      Specified by:
      handleError in class com.google.common.flogger.backend.LoggerBackend
    • log

      public void log(@Nonnull LogRecord logRecord)
    • log

      public void log(@Nonnull LogRecord logRecord, boolean sentryHandled)
    • subscribe

      public static void subscribe(CopyOnWriteArrayList<LogRecord> subscriber)
    • unsubscribe

      public static void unsubscribe(CopyOnWriteArrayList<LogRecord> subscriber)
    • getSubLogger

      @Nonnull public HytaleLoggerBackend getSubLogger(String name)
    • setSentryClient

      public void setSentryClient(@Nullable io.sentry.IScopes scope)
    • setPropagatesSentryToParent

      public void setPropagatesSentryToParent(boolean propagate)
      Sets whether exceptions logged to this logger should propagate to parent Sentry handlers. When false, exceptions will still be logged to file/console but won't be sent to parent Sentry handlers (e.g., the root logger's Sentry). This logger's own Sentry handler (if set) will still receive exceptions.
      Parameters:
      propagate - true to propagate to parent Sentry handlers (default), false to block
    • setOnLevelChange

      public void setOnLevelChange(BiConsumer<Level,Level> onLevelChange)
    • setLevel

      public void setLevel(@Nonnull Level newLevel)
    • loadLogLevel

      public void loadLogLevel()
    • loadLevels

      public static void loadLevels(@Nonnull List<Map.Entry<String,Level>> list)
    • reloadLogLevels

      public static void reloadLogLevels()
    • getLogger

      public static HytaleLoggerBackend getLogger()
      Gets the root HytaleLoggerBackend for general purpose logging. Try to avoid using this and instead get your own more granular logger when possible.
      Returns:
      The root HytaleLoggerBackend
    • getLogger

      public static HytaleLoggerBackend getLogger(@Nonnull String name)
      Gets the HytaleLoggerBackend under the provided name, creating it if necessary. If loadLogLevel is true, we will load the log level of this logger from the OptionSet.
      Parameters:
      name - The name of the logger to fetch
      Returns:
      The logger, freshly created if not existing, otherwise fetched from the cache.
    • getLogger

      @Nonnull public static HytaleLoggerBackend getLogger(String name, BiConsumer<Level,Level> onLevelChange)
      Gets the HytaleLoggerBackend under the provided name, creating it if necessary. If loadLogLevel is true, we will load the log level of this logger from the OptionSet. The onLevelChange consumer will be fired if the log level is changed.
      Parameters:
      name - The name of the logger to fetch
      onLevelChange - A callback to fire whenever this logger's setLevel() is called.
      Returns:
      The logger, freshly created if not existing, otherwise fetched from the cache.
    • setIndent

      public static void setIndent(int indent)
    • isJunitTest

      public static boolean isJunitTest()
    • rawLog

      public static void rawLog(String message)