public class DetailedErrorReporter extends java.lang.Object implements ErrorReporter
Modifier and Type | Field and Description |
---|---|
protected boolean |
apacheCommonsMissing |
static int |
DEFAULT_MAX_ERROR_COUNT |
static java.lang.String |
DEFAULT_PREFIX |
static java.lang.String |
DEFAULT_SUPPORT_URL |
static java.lang.String |
ERROR_PERMISSION |
protected java.util.Map<java.lang.String,java.lang.Object> |
globalParameters |
protected java.util.concurrent.atomic.AtomicInteger |
internalErrorCount |
protected java.util.logging.Logger |
logger |
protected int |
maxErrorCount |
static java.lang.String |
PLUGIN_NAME |
protected java.lang.ref.WeakReference<org.bukkit.plugin.Plugin> |
pluginReference |
protected java.lang.String |
prefix |
static java.lang.String |
SECOND_LEVEL_PREFIX |
protected java.lang.String |
supportURL |
Constructor and Description |
---|
DetailedErrorReporter(org.bukkit.plugin.Plugin plugin)
Create a default error reporting system.
|
DetailedErrorReporter(org.bukkit.plugin.Plugin plugin,
java.lang.String prefix,
java.lang.String supportURL)
Create a central error reporting system.
|
DetailedErrorReporter(org.bukkit.plugin.Plugin plugin,
java.lang.String prefix,
java.lang.String supportURL,
int maxErrorCount,
java.util.logging.Logger logger)
Create a central error reporting system.
|
Modifier and Type | Method and Description |
---|---|
void |
addGlobalParameter(java.lang.String key,
java.lang.Object value)
Adds the given global parameter.
|
protected java.lang.String |
addPrefix(java.lang.String text,
java.lang.String prefix)
Adds the given prefix to every line in the text.
|
void |
clearGlobalParameters() |
int |
getErrorCount() |
java.lang.Object |
getGlobalParameter(java.lang.String key) |
java.util.logging.Logger |
getLogger() |
int |
getMaxErrorCount() |
java.lang.String |
getPrefix() |
protected java.lang.String |
getStringDescription(java.lang.Object value) |
java.lang.String |
getSupportURL() |
java.util.Set<java.lang.String> |
globalParameters() |
protected boolean |
isSimpleType(java.lang.Object test)
Determine if the given object is a wrapper for a primitive/simple type or not.
|
void |
reportDetailed(java.lang.Object sender,
java.lang.String message,
java.lang.Throwable error,
java.lang.Object... parameters)
Prints a detailed error report about an unhandled exception.
|
void |
reportMinimal(org.bukkit.plugin.Plugin sender,
java.lang.String methodName,
java.lang.Throwable error)
Prints a small minimal error report about an exception from another plugin.
|
void |
reportMinimal(org.bukkit.plugin.Plugin sender,
java.lang.String methodName,
java.lang.Throwable error,
java.lang.Object... parameters)
Prints a small minimal error report about an exception from another plugin.
|
boolean |
reportMinimalNoSpam(org.bukkit.plugin.Plugin sender,
java.lang.String methodName,
java.lang.Throwable error) |
void |
reportWarning(java.lang.Object sender,
java.lang.String message)
Prints a warning message from the current plugin.
|
void |
reportWarning(java.lang.Object sender,
java.lang.String message,
java.lang.Throwable error)
Prints a warning message from the current plugin.
|
void |
setErrorCount(int errorCount) |
void |
setLogger(java.util.logging.Logger logger) |
void |
setMaxErrorCount(int maxErrorCount) |
void |
setPrefix(java.lang.String prefix) |
void |
setSupportURL(java.lang.String supportURL) |
public static final java.lang.String SECOND_LEVEL_PREFIX
public static final java.lang.String DEFAULT_PREFIX
public static final java.lang.String DEFAULT_SUPPORT_URL
public static final java.lang.String PLUGIN_NAME
public static final java.lang.String ERROR_PERMISSION
public static final int DEFAULT_MAX_ERROR_COUNT
protected java.lang.String prefix
protected java.lang.String supportURL
protected java.util.concurrent.atomic.AtomicInteger internalErrorCount
protected int maxErrorCount
protected java.util.logging.Logger logger
protected java.lang.ref.WeakReference<org.bukkit.plugin.Plugin> pluginReference
protected boolean apacheCommonsMissing
protected java.util.Map<java.lang.String,java.lang.Object> globalParameters
public DetailedErrorReporter(org.bukkit.plugin.Plugin plugin)
public DetailedErrorReporter(org.bukkit.plugin.Plugin plugin, java.lang.String prefix, java.lang.String supportURL)
plugin
- - the plugin owner.prefix
- - default line prefix.supportURL
- - URL to report the error.public DetailedErrorReporter(org.bukkit.plugin.Plugin plugin, java.lang.String prefix, java.lang.String supportURL, int maxErrorCount, java.util.logging.Logger logger)
plugin
- - the plugin owner.prefix
- - default line prefix.supportURL
- - URL to report the error.maxErrorCount
- - number of errors to print before giving up.logger
- - current logger.public void reportMinimal(org.bukkit.plugin.Plugin sender, java.lang.String methodName, java.lang.Throwable error, java.lang.Object... parameters)
ErrorReporter
reportMinimal
in interface ErrorReporter
sender
- - the other plugin.methodName
- - name of the caller method.error
- - the exception itself.parameters
- - any relevant parameters to print.public void reportMinimal(org.bukkit.plugin.Plugin sender, java.lang.String methodName, java.lang.Throwable error)
ErrorReporter
reportMinimal
in interface ErrorReporter
sender
- - the other plugin.methodName
- - name of the caller method.error
- - the exception itself.public boolean reportMinimalNoSpam(org.bukkit.plugin.Plugin sender, java.lang.String methodName, java.lang.Throwable error)
public void reportWarning(java.lang.Object sender, java.lang.String message)
ErrorReporter
reportWarning
in interface ErrorReporter
sender
- - the object containing the caller method.message
- - error message.public void reportWarning(java.lang.Object sender, java.lang.String message, java.lang.Throwable error)
ErrorReporter
reportWarning
in interface ErrorReporter
sender
- - the object containing the caller method.message
- - error message.error
- - the exception that was thrown.public void reportDetailed(java.lang.Object sender, java.lang.String message, java.lang.Throwable error, java.lang.Object... parameters)
ErrorReporter
reportDetailed
in interface ErrorReporter
sender
- - the object containing the caller method.message
- - an error message to include.error
- - the exception that was thrown in the caller method.parameters
- - parameters from the caller method.protected java.lang.String addPrefix(java.lang.String text, java.lang.String prefix)
text
- - text to modify.prefix
- - prefix added to every line in the text.protected java.lang.String getStringDescription(java.lang.Object value)
protected boolean isSimpleType(java.lang.Object test)
test
- - the object to test.public int getErrorCount()
public void setErrorCount(int errorCount)
public int getMaxErrorCount()
public void setMaxErrorCount(int maxErrorCount)
public void addGlobalParameter(java.lang.String key, java.lang.Object value)
key
- - name of parameter.value
- - the global parameter itself.public java.lang.Object getGlobalParameter(java.lang.String key)
public void clearGlobalParameters()
public java.util.Set<java.lang.String> globalParameters()
public java.lang.String getSupportURL()
public void setSupportURL(java.lang.String supportURL)
public java.lang.String getPrefix()
public void setPrefix(java.lang.String prefix)
public java.util.logging.Logger getLogger()
public void setLogger(java.util.logging.Logger logger)