Package net.dv8tion.jda.internal.utils
Class JDALogger
java.lang.Object
net.dv8tion.jda.internal.utils.JDALogger
This class serves as a LoggerFactory for JDA's internals.
It will either return a Logger from a SLF4J implementation via
It will either return a Logger from a SLF4J implementation via
LoggerFactory
if present,
or an instance of a custom FallbackLogger
.
It also has the utility method getLazyString(LazyEvaluation)
which is used to lazily construct Strings for Logging.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Functional interface used forgetLazyString(LazyEvaluation)
to lazily construct a String. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The name of the system property, which controls whether the fallback logger is disabled.static final boolean
Whether an implementation ofSLF4JServiceProvider
was found. -
Method Summary
Modifier and TypeMethodDescriptionstatic Object
getLazyString
(JDALogger.LazyEvaluation lazyLambda) Utility function to enable logging of complex statements more efficiently (lazy).static org.slf4j.Logger
Will get theLogger
for the given Class or create and cache a fallback logger if there is no SLF4J implementation present.static org.slf4j.Logger
Will get theLogger
with the given log-name or create and cache a fallback logger if there is no SLF4J implementation present.static void
setFallbackLoggerEnabled
(boolean enabled) Disables the automatic fallback logger that JDA uses when no SLF4J implementation is found.
-
Field Details
-
DISABLE_FALLBACK_PROPERTY_NAME
The name of the system property, which controls whether the fallback logger is disabled."net.dv8tion.jda.disableFallbackLogger"
- See Also:
-
SLF4J_ENABLED
public static final boolean SLF4J_ENABLEDWhether an implementation ofSLF4JServiceProvider
was found.
If false, JDA will use its fallback logger.The fallback logger can be disabled with
setFallbackLoggerEnabled(boolean)
or using the system property "net.dv8tion.jda.disableFallbackLogger".
-
-
Method Details
-
setFallbackLoggerEnabled
public static void setFallbackLoggerEnabled(boolean enabled) Disables the automatic fallback logger that JDA uses when no SLF4J implementation is found.- Parameters:
enabled
- False, to disable the fallback logger
-
getLog
Will get theLogger
with the given log-name or create and cache a fallback logger if there is no SLF4J implementation present.The fallback logger uses a constant logging configuration and prints directly to
System.err
.- Parameters:
name
- The name of the Logger- Returns:
- Logger with given log name
-
getLog
Will get theLogger
for the given Class or create and cache a fallback logger if there is no SLF4J implementation present.The fallback logger uses a constant logging configuration and prints directly to
System.err
.- Parameters:
clazz
- The class used for the Logger name- Returns:
- Logger for given Class
-
getLazyString
Utility function to enable logging of complex statements more efficiently (lazy).- Parameters:
lazyLambda
- The Supplier used when evaluating the expression- Returns:
- An Object that can be passed to SLF4J's logging methods as lazy parameter
-