Package net.sourceforge.pmd.util.log
Interface MessageReporter
-
@InternalApi public interface MessageReporter
Façade to report user-facing messages (info, warning and error). Note: messages are formatted usingMessageFormat
.Internal API: this is a transitional API that will be significantly changed in PMD 7, with the transition to SLF4J. See https://github.com/pmd/pmd/issues/3816 TODO rename to PmdReporter
- Author:
- Clément Fournier
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default RuntimeException
error(@Nullable Throwable cause, @Nullable String contextMessage, Object... formatArgs)
Only one of the cause or the message can be null.default RuntimeException
error(String message, Object... formatArgs)
default RuntimeException
error(Throwable error)
default void
errorEx(String message, Object[] formatArgs, Throwable error)
default void
errorEx(String message, Throwable error)
default void
info(String message, Object... formatArgs)
boolean
isLoggable(org.slf4j.event.Level level)
default void
log(org.slf4j.event.Level level, String message, Object... formatArgs)
void
logEx(org.slf4j.event.Level level, @Nullable String message, Object[] formatArgs, @Nullable Throwable error)
default RuntimeException
newException(org.slf4j.event.Level level, @Nullable Throwable cause, @Nullable String message, Object... formatArgs)
Logs and returns a new exception.int
numErrors()
Returns the number of errors reported on this instance.static MessageReporter
quiet()
Returns a reporter instance that does not output anything, but still counts errors.default void
warn(String message, Object... formatArgs)
default void
warnEx(String message, Object[] formatArgs, Throwable error)
default void
warnEx(String message, Throwable error)
-
-
-
Method Detail
-
isLoggable
boolean isLoggable(org.slf4j.event.Level level)
-
logEx
void logEx(org.slf4j.event.Level level, @Nullable String message, Object[] formatArgs, @Nullable Throwable error)
-
newException
default RuntimeException newException(org.slf4j.event.Level level, @Nullable Throwable cause, @Nullable String message, Object... formatArgs)
Logs and returns a new exception. Message and cause may not be null a the same time.
-
error
default RuntimeException error(String message, Object... formatArgs)
-
error
default RuntimeException error(@Nullable Throwable cause, @Nullable String contextMessage, Object... formatArgs)
Only one of the cause or the message can be null.
-
error
default RuntimeException error(Throwable error)
-
numErrors
int numErrors()
Returns the number of errors reported on this instance. Any call tolog(Level, String, Object...)
orlogEx(Level, String, Object[], Throwable)
with a level ofLevel.ERROR
should increment this number.
-
quiet
static MessageReporter quiet()
Returns a reporter instance that does not output anything, but still counts errors.
-
-