Package com.mindscapehq.raygun4java.core
Class RaygunClient
- java.lang.Object
-
- com.mindscapehq.raygun4java.core.RaygunClient
-
public class RaygunClient extends Object
This is the main sending object that you instantiate with your API key There should only be on RaygunClient per process/thread/request as it stores state about the said process/thread/request
-
-
Field Summary
Fields Modifier and Type Field Description protected StringapiKeyprotected List<RaygunBreadcrumbMessage>breadcrumbsprotected MapclientDataprotected Set<String>clientTagsprotected Stringcontextprotected IRaygunOnAfterSendonAfterSendprotected IRaygunOnBeforeSendonBeforeSendprotected IRaygunOnFailedSendonFailedSendprotected booleanshouldProcessBreadcrumbLocationprotected Stringstringprotected static StringUNHANDLED_EXCEPTIONprotected RaygunIdentifieruser
-
Constructor Summary
Constructors Constructor Description RaygunClient(String apiKey)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RaygunMessagebuildMessage(Throwable throwable, Set<String> errorTags, Map errorData)protected <T extends IRaygunMessageBuilder>
IRaygunMessageBuilderbuildMessage(T builder, Throwable throwable, Set<String> tags, Map data)voidClearBreadcrumbs()Map<?,?>getData()protected MapgetDataForError(Map errorData)protected StringgetMachineName()IRaygunOnAfterSendgetOnAfterSend()IRaygunOnBeforeSendgetOnBeforeSend()Set<String>getTags()protected Set<String>getTagsForError(Set<String> errorTags)static RaygunBreadcrumbMessageprocessBreadCrumbCodeLocation(boolean process, RaygunBreadcrumbMessage breadcrumbMessage, int stackFrame)RaygunBreadcrumbMessagerecordBreadcrumb(RaygunBreadcrumbMessage breadcrumb)RaygunBreadcrumbMessagerecordBreadcrumb(String message)intsend(RaygunMessage raygunMessage)intsend(String payload)intsend(Throwable throwable)Use this method to send a handled exception to Raygunintsend(Throwable throwable, Map data)intsend(Throwable throwable, Set<String> tags)intsend(Throwable throwable, Set<String> tags, Map data)intsendUnhandled(Throwable throwable)Use this method to send an unhandled exception to Raygun (it will be tagged as an unhandled exception)intsendUnhandled(Throwable throwable, Map data)intsendUnhandled(Throwable throwable, Set<String> tags)intsendUnhandled(Throwable throwable, Set<String> tags, Map data)voidsetData(Map<?,?> data)voidsetOnAfterSend(IRaygunOnAfterSend onAfterSend)voidsetOnBeforeSend(IRaygunOnBeforeSend onBeforeSend)voidsetOnFailedSend(IRaygunOnFailedSend onFailedSend)voidsetRaygunConnection(RaygunConnection raygunConnection)voidsetTags(Set<String> tags)voidsetUser(RaygunIdentifier userIdentity)voidsetVersion(String version)voidsetVersionFrom(Class getVersionFrom)booleanshouldProcessBreadcrumbLocation()voidshouldProcessBreadcrumbLocation(boolean shouldProcessBreadcrumbLocation)BEWARE: setting this to true could seriously degrade performance of your applicationStringtoJson(Object o)protected BooleanvalidateApiKey()RaygunClientwithData(Object key, Object value)This data will be added to all errors sent from this instance of the clientRaygunClientwithTag(String tag)These tags will be added to all errors sent from this instance of the client
-
-
-
Field Detail
-
UNHANDLED_EXCEPTION
protected static final String UNHANDLED_EXCEPTION
- See Also:
- Constant Field Values
-
apiKey
protected String apiKey
-
user
protected RaygunIdentifier user
-
context
protected String context
-
string
protected String string
-
onBeforeSend
protected IRaygunOnBeforeSend onBeforeSend
-
onAfterSend
protected IRaygunOnAfterSend onAfterSend
-
onFailedSend
protected IRaygunOnFailedSend onFailedSend
-
breadcrumbs
protected List<RaygunBreadcrumbMessage> breadcrumbs
-
clientData
protected Map clientData
-
shouldProcessBreadcrumbLocation
protected boolean shouldProcessBreadcrumbLocation
-
-
Constructor Detail
-
RaygunClient
public RaygunClient(String apiKey)
-
-
Method Detail
-
setRaygunConnection
public void setRaygunConnection(RaygunConnection raygunConnection)
-
getMachineName
protected String getMachineName()
-
setUser
public void setUser(RaygunIdentifier userIdentity)
-
setVersion
public void setVersion(String version)
-
setVersionFrom
public void setVersionFrom(Class getVersionFrom)
-
send
public int send(Throwable throwable)
Use this method to send a handled exception to Raygun- Parameters:
throwable- a handled exception- Returns:
- send status code
-
sendUnhandled
public int sendUnhandled(Throwable throwable)
Use this method to send an unhandled exception to Raygun (it will be tagged as an unhandled exception)- Parameters:
throwable- an unhandled exception- Returns:
- send status code
-
buildMessage
public RaygunMessage buildMessage(Throwable throwable, Set<String> errorTags, Map errorData)
-
buildMessage
protected <T extends IRaygunMessageBuilder> IRaygunMessageBuilder buildMessage(T builder, Throwable throwable, Set<String> tags, Map data)
-
send
public int send(RaygunMessage raygunMessage)
-
send
public int send(String payload) throws IOException
- Throws:
IOException
-
setOnBeforeSend
public void setOnBeforeSend(IRaygunOnBeforeSend onBeforeSend)
-
setOnAfterSend
public void setOnAfterSend(IRaygunOnAfterSend onAfterSend)
-
setOnFailedSend
public void setOnFailedSend(IRaygunOnFailedSend onFailedSend)
-
getOnBeforeSend
public IRaygunOnBeforeSend getOnBeforeSend()
-
getOnAfterSend
public IRaygunOnAfterSend getOnAfterSend()
-
shouldProcessBreadcrumbLocation
public boolean shouldProcessBreadcrumbLocation()
-
shouldProcessBreadcrumbLocation
public void shouldProcessBreadcrumbLocation(boolean shouldProcessBreadcrumbLocation)
BEWARE: setting this to true could seriously degrade performance of your application- Parameters:
shouldProcessBreadcrumbLocation- true to process breadcrumpr location
-
recordBreadcrumb
public RaygunBreadcrumbMessage recordBreadcrumb(String message)
-
recordBreadcrumb
public RaygunBreadcrumbMessage recordBreadcrumb(RaygunBreadcrumbMessage breadcrumb)
-
withTag
public RaygunClient withTag(String tag)
These tags will be added to all errors sent from this instance of the client- Parameters:
tag- the tag to be associated with the errors- Returns:
- client
-
getData
public Map<?,?> getData()
-
setData
public void setData(Map<?,?> data)
-
withData
public RaygunClient withData(Object key, Object value)
This data will be added to all errors sent from this instance of the client- Parameters:
key- the key of the key-value pairvalue- the value of the key-value pair- Returns:
- client
-
ClearBreadcrumbs
public void ClearBreadcrumbs()
-
processBreadCrumbCodeLocation
public static RaygunBreadcrumbMessage processBreadCrumbCodeLocation(boolean process, RaygunBreadcrumbMessage breadcrumbMessage, int stackFrame)
-
-