public class DetailedErrorReporter extends Object implements ErrorReporter
| Modifier and Type | Field and Description |
|---|---|
protected static boolean |
apacheCommonsMissing |
static int |
DEFAULT_MAX_ERROR_COUNT |
static String |
DEFAULT_PREFIX |
static String |
DEFAULT_SUPPORT_URL |
protected boolean |
detailedReporting |
static String |
ERROR_PERMISSION |
protected Map<String,Object> |
globalParameters |
protected AtomicInteger |
internalErrorCount |
protected Logger |
logger |
protected int |
maxErrorCount |
protected String |
pluginName |
protected WeakReference<org.bukkit.plugin.Plugin> |
pluginReference |
protected String |
prefix |
static ReportType |
REPORT_EXCEPTION_COUNT
Report format for printing the current exception count.
|
static String |
SECOND_LEVEL_PREFIX |
protected String |
supportURL |
| Constructor and Description |
|---|
DetailedErrorReporter(org.bukkit.plugin.Plugin plugin)
Create a default error reporting system.
|
DetailedErrorReporter(org.bukkit.plugin.Plugin plugin,
String prefix,
String supportURL)
Create a central error reporting system.
|
DetailedErrorReporter(org.bukkit.plugin.Plugin plugin,
String prefix,
String supportURL,
int maxErrorCount,
Logger logger)
Create a central error reporting system.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addGlobalParameter(String key,
Object value)
Adds the given global parameter.
|
protected String |
addPrefix(String text,
String prefix)
Adds the given prefix to every line in the text.
|
protected boolean |
canReport(Report report)
Determine if we should print the given report.
|
void |
clearGlobalParameters()
Reset all global parameters.
|
int |
getErrorCount()
Retrieve the current number of errors printed through
reportDetailed(Object, Report). |
Object |
getGlobalParameter(String key)
Retrieve a global parameter by its key.
|
Logger |
getLogger()
Retrieve the current logger that is used to print all reports.
|
int |
getMaxErrorCount()
Retrieve the maximum number of errors we can print before we begin suppressing errors.
|
String |
getPrefix()
Retrieve the prefix to apply to every line in the error reports.
|
static String |
getStringDescription(Object value)
Retrieve a string representation of the given object.
|
String |
getSupportURL()
Retrieve the support URL that will be added to all detailed reports.
|
Set<String> |
globalParameters()
Retrieve a set of every registered global parameter.
|
boolean |
isDetailedReporting()
Determine if we're using detailed error reporting.
|
protected static boolean |
isSimpleType(Object test)
Determine if the given object is a wrapper for a primitive/simple type or not.
|
void |
reportDebug(Object sender,
Report.ReportBuilder builder)
Prints a debug message from the current sender.
|
void |
reportDebug(Object sender,
Report report)
Prints a debug message from the current sender.
|
void |
reportDetailed(Object sender,
Report.ReportBuilder reportBuilder)
Prints a detailed error report about an unhandled exception.
|
void |
reportDetailed(Object sender,
Report report)
Prints a detailed error report about an unhandled exception.
|
void |
reportMinimal(org.bukkit.plugin.Plugin sender,
String methodName,
Throwable error)
Prints a small minimal error report regarding an exception from another plugin.
|
void |
reportMinimal(org.bukkit.plugin.Plugin sender,
String methodName,
Throwable error,
Object... parameters)
Prints a small minimal error report regarding an exception from another plugin.
|
boolean |
reportMinimalNoSpam(org.bukkit.plugin.Plugin sender,
String methodName,
Throwable error)
Report a problem with a given method and plugin, ensuring that we don't exceed the maximum number of error reports.
|
void |
reportWarning(Object sender,
Report.ReportBuilder reportBuilder)
Prints a warning message from the current plugin.
|
void |
reportWarning(Object sender,
Report report)
Prints a warning message from the current plugin.
|
void |
setDetailedReporting(boolean detailedReporting)
Set whether or not to use detailed error reporting.
|
void |
setErrorCount(int errorCount)
Set the number of errors printed.
|
void |
setLogger(Logger logger)
Set the current logger that is used to print all reports.
|
void |
setMaxErrorCount(int maxErrorCount)
Set the maximum number of errors we can print before we begin suppressing errors.
|
void |
setPrefix(String prefix)
Set the prefix to apply to every line in the error reports.
|
void |
setSupportURL(String supportURL)
Set the support URL that will be added to all detailed reports.
|
public static final ReportType REPORT_EXCEPTION_COUNT
public static final String SECOND_LEVEL_PREFIX
public static final String DEFAULT_PREFIX
public static final String DEFAULT_SUPPORT_URL
public static final String ERROR_PERMISSION
public static final int DEFAULT_MAX_ERROR_COUNT
protected String prefix
protected String supportURL
protected AtomicInteger internalErrorCount
protected int maxErrorCount
protected Logger logger
protected WeakReference<org.bukkit.plugin.Plugin> pluginReference
protected String pluginName
protected static boolean apacheCommonsMissing
protected boolean detailedReporting
public DetailedErrorReporter(org.bukkit.plugin.Plugin plugin)
plugin - - the plugin owner.public DetailedErrorReporter(org.bukkit.plugin.Plugin plugin,
String prefix,
String supportURL)
plugin - - the plugin owner.prefix - - default line prefix.supportURL - - URL to report the error.public DetailedErrorReporter(org.bukkit.plugin.Plugin plugin,
String prefix,
String supportURL,
int maxErrorCount,
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 boolean isDetailedReporting()
public void setDetailedReporting(boolean detailedReporting)
detailedReporting - - TRUE to enable it, FALSE otherwise.public void reportMinimal(org.bukkit.plugin.Plugin sender,
String methodName,
Throwable error,
Object... parameters)
ErrorReporterreportMinimal in interface ErrorReportersender - - 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,
String methodName,
Throwable error)
ErrorReporterreportMinimal in interface ErrorReportersender - - the other plugin.methodName - - name of the caller method.error - - the exception itself.public boolean reportMinimalNoSpam(org.bukkit.plugin.Plugin sender,
String methodName,
Throwable error)
sender - - the component that observed this exception.methodName - - the method name.error - - the error itself.public void reportDebug(Object sender, Report.ReportBuilder builder)
ErrorReporterreportDebug in interface ErrorReportersender - - the sender.builder - - the report builder.public void reportDebug(Object sender, Report report)
ErrorReporterMost users will not see this message.
reportDebug in interface ErrorReportersender - - the sender.report - - the report.public void reportWarning(Object sender, Report.ReportBuilder reportBuilder)
ErrorReporterreportWarning in interface ErrorReportersender - - the object containing the caller method.reportBuilder - - an error report builder that will be used to get the report.public void reportWarning(Object sender, Report report)
ErrorReporterreportWarning in interface ErrorReportersender - - the object containing the caller method.report - - an error report to include.protected boolean canReport(Report report)
The default implementation will check for rate limits.
report - - the report to check.public void reportDetailed(Object sender, Report.ReportBuilder reportBuilder)
ErrorReporterreportDetailed in interface ErrorReportersender - - the object containing the caller method.reportBuilder - - an error report builder that will be used to get the report.public void reportDetailed(Object sender, Report report)
ErrorReporterreportDetailed in interface ErrorReportersender - - the object containing the caller method.report - - an error report to include.protected String addPrefix(String text, String prefix)
text - - text to modify.prefix - - prefix added to every line in the text.public static String getStringDescription(Object value)
value - - object to convert.protected static boolean isSimpleType(Object test)
test - - the object to test.public int getErrorCount()
reportDetailed(Object, Report).public void setErrorCount(int errorCount)
errorCount - - new number of errors printed.public int getMaxErrorCount()
public void setMaxErrorCount(int maxErrorCount)
maxErrorCount - - new max count.public void addGlobalParameter(String key, Object value)
Both key and value must be non-null.
key - - name of parameter.value - - the global parameter itself.public Object getGlobalParameter(String key)
key - - key of the parameter to retrieve.public void clearGlobalParameters()
public Set<String> globalParameters()
public String getSupportURL()
public void setSupportURL(String supportURL)
supportURL - - the new support URL.public String getPrefix()
public void setPrefix(String prefix)
prefix - - new prefix.public Logger getLogger()
public void setLogger(Logger logger)
logger - - new logger.Copyright © 2012–2017 Comphenix and dmulloy2. Licensed under the GNU GPL v2.