public final class Bugsnag
extends java.lang.Object
Client| Modifier and Type | Method and Description |
|---|---|
static void |
addToTab(java.lang.String tab,
java.lang.String key,
java.lang.Object value)
Add diagnostic information to every error report.
|
static void |
beforeNotify(BeforeNotify beforeNotify)
Add a "before notify" callback, to execute code before every
report to Bugsnag.
|
static void |
clearBreadcrumbs()
Clear any breadcrumbs that have been left so far.
|
static void |
clearTab(java.lang.String tabName)
Remove a tab of app-wide diagnostic information
|
void |
clearUser()
Removes the current user data and sets it back to defaults
|
static void |
disableExceptionHandler()
Disable automatic reporting of unhandled exceptions.
|
static void |
enableExceptionHandler()
Enable automatic reporting of unhandled exceptions.
|
static Client |
getClient()
Get the current Bugsnag Client instance.
|
java.lang.String |
getContext()
Gets the context to be sent to Bugsnag.
|
static MetaData |
getMetaData()
Get the global diagnostic information currently stored in MetaData.
|
static Client |
init(android.content.Context androidContext)
Initialize the static Bugsnag client
|
static Client |
init(android.content.Context androidContext,
Configuration config)
Initialize the static Bugsnag client
|
static Client |
init(android.content.Context androidContext,
java.lang.String apiKey)
Initialize the static Bugsnag client
|
static Client |
init(android.content.Context androidContext,
java.lang.String apiKey,
boolean enableExceptionHandler)
Initialize the static Bugsnag client
|
static void |
leaveBreadcrumb(java.lang.String message)
Leave a "breadcrumb" log message, representing an action that occurred
in your app, to aid with debugging.
|
static void |
leaveBreadcrumb(java.lang.String name,
BreadcrumbType type,
java.util.Map<java.lang.String,java.lang.String> metadata)
Leave a "breadcrumb" log message representing an action or event which
occurred in your app, to aid with debugging
|
static void |
notify(java.lang.String name,
java.lang.String message,
java.lang.StackTraceElement[] stacktrace,
Callback callback)
Notify Bugsnag of an error
|
static void |
notify(java.lang.String name,
java.lang.String message,
java.lang.StackTraceElement[] stacktrace,
Severity severity,
MetaData metaData)
Deprecated.
Use
notify(String,String,StackTraceElement[],Callback)
to send and modify error reports |
static void |
notify(java.lang.String name,
java.lang.String message,
java.lang.String context,
java.lang.StackTraceElement[] stacktrace,
Severity severity,
MetaData metaData)
Deprecated.
Use
notify(String,String,StackTraceElement[],Callback)
to send and modify error reports |
static void |
notify(java.lang.Throwable exception)
Notify Bugsnag of a handled exception
|
static void |
notify(java.lang.Throwable exception,
Callback callback)
Notify Bugsnag of a handled exception
|
static void |
notify(java.lang.Throwable exception,
MetaData metaData)
Deprecated.
Use
notify(Throwable,Callback)
to send and modify error reports |
static void |
notify(java.lang.Throwable exception,
Severity severity)
Notify Bugsnag of a handled exception
|
static void |
notify(java.lang.Throwable exception,
Severity severity,
MetaData metaData)
Deprecated.
Use
notify(Throwable,Callback)
to send and modify error reports |
static void |
setAppVersion(java.lang.String appVersion)
Set the application version sent to Bugsnag.
|
static void |
setBuildUUID(java.lang.String buildUUID)
Set the buildUUID to your own value.
|
static void |
setContext(java.lang.String context)
Set the context sent to Bugsnag.
|
static void |
setEndpoint(java.lang.String endpoint)
Deprecated.
use
Configuration.setEndpoint(String) instead. |
static void |
setFilters(java.lang.String... filters)
Set which keys should be filtered when sending metaData to Bugsnag.
|
static void |
setIgnoreClasses(java.lang.String... ignoreClasses)
Set which exception classes should be ignored (not sent) by Bugsnag.
|
static void |
setMaxBreadcrumbs(int numBreadcrumbs)
Set the maximum number of breadcrumbs to keep and sent to Bugsnag.
|
static void |
setMetaData(MetaData metaData)
Set the global diagnostic information to be send with every error.
|
static void |
setNotifyReleaseStages(java.lang.String... notifyReleaseStages)
Set for which releaseStages errors should be sent to Bugsnag.
|
static void |
setProjectPackages(java.lang.String... projectPackages)
Set which packages should be considered part of your application.
|
static void |
setReleaseStage(java.lang.String releaseStage)
Set the current "release stage" of your application.
|
static void |
setSendThreads(boolean sendThreads)
Set whether to send thread-state with report.
|
static void |
setUser(java.lang.String id,
java.lang.String email,
java.lang.String name)
Set details of the user currently using your application.
|
static void |
setUserEmail(java.lang.String email)
Set the email address of the current user.
|
static void |
setUserId(java.lang.String id)
Set a unique identifier for the user currently using your application.
|
static void |
setUserName(java.lang.String name)
Set the name of the current user.
|
public static Client init(android.content.Context androidContext)
androidContext - an Android context, usually thispublic static Client init(android.content.Context androidContext, java.lang.String apiKey)
androidContext - an Android context, usually thisapiKey - your Bugsnag API key from your Bugsnag dashboardpublic static Client init(android.content.Context androidContext, java.lang.String apiKey, boolean enableExceptionHandler)
androidContext - an Android context, usually thisapiKey - your Bugsnag API key from your Bugsnag dashboardenableExceptionHandler - should we automatically handle uncaught exceptions?public static Client init(android.content.Context androidContext, Configuration config)
androidContext - an Android context, usually thisconfig - a configuration for the Clientpublic static void setAppVersion(java.lang.String appVersion)
appVersion - the app version to sendpublic java.lang.String getContext()
public static void setContext(java.lang.String context)
context - set what was happening at the time of a crash@Deprecated public static void setEndpoint(java.lang.String endpoint)
Configuration.setEndpoint(String) instead.endpoint - the custom endpoint to send report topublic static void setBuildUUID(java.lang.String buildUUID)
buildUUID - the buildUUID.public static void setFilters(java.lang.String... filters)
filters - a list of keys to filter from metaDatapublic static void setIgnoreClasses(java.lang.String... ignoreClasses)
ignoreClasses - a list of exception classes to ignorepublic static void setNotifyReleaseStages(java.lang.String... notifyReleaseStages)
notifyReleaseStages - a list of releaseStages to notify forsetReleaseStage(java.lang.String)public static void setProjectPackages(java.lang.String... projectPackages)
projectPackages - a list of package namespublic static void setReleaseStage(java.lang.String releaseStage)
releaseStage - the release stage of the appsetNotifyReleaseStages(java.lang.String...)public static void setSendThreads(boolean sendThreads)
sendThreads - should we send thread-state with report?public static void setUser(java.lang.String id,
java.lang.String email,
java.lang.String name)
id - a unique identifier of the current user (defaults to a unique id)email - the email address of the current username - the name of the current userpublic void clearUser()
public static void setUserId(java.lang.String id)
id - a unique identifier of the current userpublic static void setUserEmail(java.lang.String email)
email - the email address of the current userpublic static void setUserName(java.lang.String name)
name - the name of the current userpublic static void beforeNotify(BeforeNotify beforeNotify)
false from any callback to halt execution.
For example:
Bugsnag.beforeNotify(new BeforeNotify() {
public boolean run(Error error) {
error.setSeverity(Severity.INFO);
return true;
}
})beforeNotify - a callback to run before sending errors to BugsnagBeforeNotifypublic static void notify(java.lang.Throwable exception)
exception - the exception to send to Bugsnagpublic static void notify(java.lang.Throwable exception,
Callback callback)
exception - the exception to send to Bugsnagcallback - callback invoked on the generated error report for
additional modificationpublic static void notify(java.lang.String name,
java.lang.String message,
java.lang.StackTraceElement[] stacktrace,
Callback callback)
name - the error name or classmessage - the error messagestacktrace - the stackframes associated with the errorcallback - callback invoked on the generated error report for
additional modificationpublic static void notify(java.lang.Throwable exception,
Severity severity)
exception - the exception to send to Bugsnagseverity - the severity of the error, one of Severity.ERROR,
Severity.WARNING or Severity.INFOpublic static void notify(java.lang.Throwable exception,
MetaData metaData)
notify(Throwable,Callback)
to send and modify error reportsexception - the exception to send to BugsnagmetaData - additional information to send with the exception@Deprecated
public static void notify(java.lang.Throwable exception,
Severity severity,
MetaData metaData)
notify(Throwable,Callback)
to send and modify error reportsexception - the exception to send to Bugsnagseverity - the severity of the error, one of Severity.ERROR,
Severity.WARNING or Severity.INFOmetaData - additional information to send with the exception@Deprecated
public static void notify(java.lang.String name,
java.lang.String message,
java.lang.StackTraceElement[] stacktrace,
Severity severity,
MetaData metaData)
notify(String,String,StackTraceElement[],Callback)
to send and modify error reportsname - the error name or classmessage - the error messagestacktrace - the stackframes associated with the errorseverity - the severity of the error, one of Severity.ERROR,
Severity.WARNING or Severity.INFOmetaData - additional information to send with the exception@Deprecated
public static void notify(java.lang.String name,
java.lang.String message,
java.lang.String context,
java.lang.StackTraceElement[] stacktrace,
Severity severity,
MetaData metaData)
notify(String,String,StackTraceElement[],Callback)
to send and modify error reportsname - the error name or classmessage - the error messagecontext - the error contextstacktrace - the stackframes associated with the errorseverity - the severity of the error, one of Severity.ERROR,
Severity.WARNING or Severity.INFOmetaData - additional information to send with the exceptionpublic static void addToTab(java.lang.String tab,
java.lang.String key,
java.lang.Object value)
tab - the dashboard tab to add diagnostic data tokey - the name of the diagnostic informationvalue - the contents of the diagnostic informationpublic static void clearTab(java.lang.String tabName)
tabName - the dashboard tab to remove diagnostic data frompublic static MetaData getMetaData()
MetaDatapublic static void setMetaData(MetaData metaData)
MetaDatapublic static void leaveBreadcrumb(java.lang.String message)
message - the log message to leave (max 140 chars)public static void leaveBreadcrumb(java.lang.String name,
BreadcrumbType type,
java.util.Map<java.lang.String,java.lang.String> metadata)
name - A short label (max 32 chars)type - A category for the breadcrumbmetadata - Additional diagnostic information about the app environmentpublic static void setMaxBreadcrumbs(int numBreadcrumbs)
numBreadcrumbs - number of breadcrumb log messages to sendpublic static void clearBreadcrumbs()
public static void enableExceptionHandler()
public static void disableExceptionHandler()
public static Client getClient()