Class LoggingExceptionCallback
java.lang.Object
com.helger.commons.callback.exception.LoggingExceptionCallback
- All Implemented Interfaces:
IExceptionCallback<Throwable>,ICallback,IHasErrorLevel,IErrorIndicator,ISuccessIndicator
@ThreadSafe
public class LoggingExceptionCallback
extends Object
implements IExceptionCallback<Throwable>, IHasErrorLevel
A specific implementation of the
IExceptionCallback interface, that
logs all exceptions to a standard logger.- Author:
- Philip Helger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringGet the text to be logged for a certain exceptionprotected booleanCheck if the passed exception should be part of the log entry.voidCalled when an exception of the specified type occurred.final LoggingExceptionCallbacksetErrorLevel(IErrorLevel aErrorLevel) Set the error level to be used.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.commons.error.level.IHasErrorLevel
hasErrorLevel, isError, isFailure, isNoError, isSuccessMethods inherited from interface com.helger.commons.state.ISuccessIndicator
and, or
-
Constructor Details
-
LoggingExceptionCallback
public LoggingExceptionCallback()
-
-
Method Details
-
getErrorLevel
- Specified by:
getErrorLevelin interfaceIHasErrorLevel- Returns:
- The configured error level. Never
null.
-
setErrorLevel
Set the error level to be used.- Parameters:
aErrorLevel- Error level to use. May not benull.- Returns:
- this for chaining
-
getLogMessage
Get the text to be logged for a certain exception- Parameters:
t- The exception to be logged. May theoretically benull.- Returns:
- The text to be logged. May neither be
nullnor empty.
-
isLogException
Check if the passed exception should be part of the log entry.- Parameters:
t- The exception to check. May theoretically benull.- Returns:
trueto log the exception,falseto not log it
-
onException
Description copied from interface:IExceptionCallbackCalled when an exception of the specified type occurred. You may not re-throw the exception from in here!- Specified by:
onExceptionin interfaceIExceptionCallback<Throwable>- Parameters:
t- The exception. Nevernull.
-
toString
-