Package eu.cloudnetservice.common.log
Class LoggingUtil
java.lang.Object
eu.cloudnetservice.common.log.LoggingUtil
Holds some utility methods to work with loggers.
- Since:
- 4.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the default log level configured for the CloudNet runtime using thecloudnet.logging.defaultlevelsystem property.static voidprintStackTraceInto(@NonNull StringBuilder stringBuilder, @NonNull LogRecord record) Prints the throwable of the log record into the given string builder.static voidremoveHandlers(@NonNull Logger logger) Removes all registered handlers from the given logger.
-
Constructor Details
-
LoggingUtil
private LoggingUtil()
-
-
Method Details
-
defaultLogLevel
Gets the default log level configured for the CloudNet runtime using thecloudnet.logging.defaultlevelsystem 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
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.
-