public class RecordingExceptionHandler extends Object implements ExceptionHandler
Each ExceptionKey is constructed using a LogLevel, the Class where the exception happened, a custom message, and the Throwable object representing the exception. The LogLevel is provided at instantiation, while the rest are provided when an exception occurs.
If the exceptionsOnly flag is set, the handler will ignore errors that are not associated with a Throwable.
| Constructor and Description |
|---|
RecordingExceptionHandler(LogLevel level,
Map<ExceptionKey,Integer> exceptionKeyCountMap,
boolean exceptionsOnly)
Constructs an instance of RecordingExceptionHandler with the specified LogLevel, map for exception counts, and exceptionsOnly flag.
|
| Modifier and Type | Method and Description |
|---|---|
void |
on(@NotNull Class<?> clazz,
@Nullable String message,
Throwable thrown)
Records an exception by incrementing the count of its corresponding ExceptionKey in the map.
|
void |
on(@NotNull org.slf4j.Logger logger,
@Nullable String message,
Throwable thrown)
Records an exception by incrementing the count of its corresponding ExceptionKey in the map.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdefaultHandler, ignoresEverything, isEnabled, on, on, onpublic RecordingExceptionHandler(LogLevel level, Map<ExceptionKey,Integer> exceptionKeyCountMap, boolean exceptionsOnly)
level - the LogLevel for the ExceptionKeys.exceptionKeyCountMap - the map where the count of each ExceptionKey will be stored.exceptionsOnly - a flag indicating if the handler should ignore errors that are not associated with a Throwable.public void on(@NotNull
@NotNull Class<?> clazz,
@Nullable
@Nullable String message,
Throwable thrown)
on in interface ExceptionHandlerclazz - the class where the exception occurred. Must not be null.message - a custom message detailing the error, or null.thrown - the throwable instance representing the error, or null.public void on(@NotNull
@NotNull org.slf4j.Logger logger,
@Nullable
@Nullable String message,
Throwable thrown)
on in interface ExceptionHandlerlogger - the logger instance. Must not be null.message - a custom message detailing the error, or null.thrown - the throwable instance representing the error, or null.Copyright © 2024. All rights reserved.