Class LoggingUtil

java.lang.Object
eu.cloudnetservice.common.log.LoggingUtil

public final class LoggingUtil extends Object
Holds some utility methods to work with loggers.
Since:
4.0
  • Constructor Details

    • LoggingUtil

      private LoggingUtil()
  • Method Details

    • defaultLogLevel

      @NonNull public static @NonNull Level defaultLogLevel()
      Gets the default log level configured for the CloudNet runtime using the cloudnet.logging.defaultlevel system property. If no level is set or the level cannot be parsed from the provided string this method falls back to the info log level.
      Returns:
      the configured log level of the system, info if not or an invalid value was set.
    • removeHandlers

      public static void removeHandlers(@NonNull @NonNull Logger logger)
      Removes all registered handlers from the given logger.
      Parameters:
      logger - the logger to remove the handlers of.
      Throws:
      NullPointerException - if the given logger is null.
    • printStackTraceInto

      public static void printStackTraceInto(@NonNull @NonNull StringBuilder stringBuilder, @NonNull @NonNull LogRecord record)
      Prints the throwable of the log record into the given string builder. If the given record has no associated exception set this method does nothing.
      Parameters:
      stringBuilder - the string builder to print the exception to.
      record - the record of which the exception should get printed into the builder.
      Throws:
      NullPointerException - if the given string builder or log record is null.