Enum Class Loglevel
- All Implemented Interfaces:
Serializable,Comparable<Loglevel>,Constable
The possible log levels.
This class uses by default log4j internally,
but the logging framework can be exchanged using the
setLoggingAdapter method.
The public API of this class is agnostic of the logging framework.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionvoidapply()Applies the log level.static LoglevelReturns the Loglevel for a given key.static LoglevelReturns the current loglevel.getKey()Returns the key of the Loglevel.static LoggingAdapterReturns the currently used logging adapter.static voidsetLoggingAdapter(LoggingAdapter loggingAdapter) Sets the logging adapter.static LoglevelReturns the enum constant of this class with the specified name.static Loglevel[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
TRACE
Loglevel trace. -
DEBUG
Loglevel debug. -
INFO
Loglevel info. -
WARN
Loglevel warn. -
ERROR
Loglevel error.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getKey
Returns the key of the Loglevel.- Returns:
- the key of the Loglevel, not null.
-
apply
public void apply()Applies the log level. -
getByKey
Returns the Loglevel for a given key.- Parameters:
key- the key to look for.- Returns:
- the corresponding Loglevel, not null.
- Throws:
IllegalArgumentException- if no Loglevel can be found for the key.
-
getCurrentLoglevel
Returns the current loglevel.- Returns:
- the current loglevel, or INFO if the current loglevel cannot be determined.
-
getLoggingAdapter
Returns the currently used logging adapter.- Returns:
- the current logging adapter, not null.
-
setLoggingAdapter
Sets the logging adapter.- Parameters:
loggingAdapter- the logging adapter- Throws:
NullPointerException- if loggingAdapter is null.
-