public enum Slf4jExceptionHandler extends Enum<Slf4jExceptionHandler> implements ExceptionHandler
Each instance of Slf4jExceptionHandler logs at a specific level and corresponds to a LogLevel enum. This is used to map LogLevel enums to their corresponding Slf4jExceptionHandler instances via the valueOf(LogLevel logLevel) method.
The DEBUG instance also overrides the isEnabled(Class clazz) method, using the isDebugEnabled() method from SLF4J's Logger class.
There's also a utility method isJUnitTest() which is used to detect if the current execution context is a JUnit test.
| Modifier and Type | Method and Description |
|---|---|
static Slf4jExceptionHandler |
valueOf(LogLevel logLevel)
Returns the appropriate Slf4jExceptionHandler value based on the given LogLevel.
|
static Slf4jExceptionHandler |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Slf4jExceptionHandler[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfdefaultHandler, ignoresEverything, isEnabled, on, on, on, on, onpublic static final Slf4jExceptionHandler ERROR
public static final Slf4jExceptionHandler WARN
public static final Slf4jExceptionHandler PERF
public static final Slf4jExceptionHandler DEBUG
public static Slf4jExceptionHandler[] values()
for (Slf4jExceptionHandler c : Slf4jExceptionHandler.values()) System.out.println(c);
public static Slf4jExceptionHandler valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static Slf4jExceptionHandler valueOf(LogLevel logLevel)
logLevel - the LogLevel enum to convert.Copyright © 2024. All rights reserved.