-
- All Implemented Interfaces:
-
backtraceio.library.interfaces.Breadcrumbs
public class BacktraceBreadcrumbs implements Breadcrumbs
-
-
Field Summary
Fields Modifier and Type Field Description private OnSuccessfulBreadcrumbAddEventListener
onSuccessfulBreadcrumbAddEventListener
private EnumSet<BacktraceBreadcrumbType>
enabledBreadcrumbTypes
public final static int
DEFAULT_MAX_LOG_SIZE_BYTES
-
Constructor Summary
Constructors Constructor Description BacktraceBreadcrumbs(String breadcrumbLogDirectory)
-
Method Summary
Modifier and Type Method Description void
setOnSuccessfulBreadcrumbAddEventListener(OnSuccessfulBreadcrumbAddEventListener eventListener)
Set event executed after adding a breadcrumb to the file EnumSet<BacktraceBreadcrumbType>
getEnabledBreadcrumbTypes()
Gets the enabled breadcrumb types boolean
enableBreadcrumbs(Context context)
Enable logging of breadcrumbs and submission with crash reports boolean
enableBreadcrumbs(Context context, EnumSet<BacktraceBreadcrumbType> breadcrumbTypesToEnable)
Enable logging of breadcrumbs and submission with crash reports boolean
enableBreadcrumbs(Context context, int maxBreadcrumbLogSizeBytes)
Enable logging of breadcrumbs and submission with crash reports boolean
enableBreadcrumbs(Context context, EnumSet<BacktraceBreadcrumbType> breadcrumbTypesToEnable, int maxBreadcrumbLogSizeBytes)
Enable logging of breadcrumbs and submission with crash reports boolean
clearBreadcrumbs()
Clear breadcrumb logs void
setCurrentBreadcrumbId(long breadcrumbId)
NOTE: This should only be used for testing long
getCurrentBreadcrumbId()
Get the current breadcrumb ID (exclusive). boolean
addBreadcrumb(String message)
Add a breadcrumb of type "Manual" and level "Info" with the provided message string boolean
addBreadcrumb(String message, BacktraceBreadcrumbLevel level)
Add a breadcrumb of type "Manual" and the desired level with the provided message string boolean
addBreadcrumb(String message, Map<String, Object> attributes)
Add a breadcrumb of type "Manual" and level "Info" with the provided message string and attributes boolean
addBreadcrumb(String message, Map<String, Object> attributes, BacktraceBreadcrumbLevel level)
Add a breadcrumb of type "Manual" and the desired level with the provided message string and attributes boolean
addBreadcrumb(String message, BacktraceBreadcrumbType type)
Add a breadcrumb of the desired type and level "Info" with the provided message string boolean
addBreadcrumb(String message, BacktraceBreadcrumbType type, BacktraceBreadcrumbLevel level)
Add a breadcrumb of the desired level and type with the provided message string boolean
addBreadcrumb(String message, Map<String, Object> attributes, BacktraceBreadcrumbType type)
Add a breadcrumb of the desired type and level "Info" with the provided message string and attributes boolean
addBreadcrumb(String message, Map<String, Object> attributes, BacktraceBreadcrumbType type, BacktraceBreadcrumbLevel level)
Add a breadcrumb of the desired level and type with the provided message string and attributes void
processReportBreadcrumbs(BacktraceReport backtraceReport)
If Breadcrumbs is currently enabled, process the BacktraceReport for sending the Breadcrumb logs boolean
isEnabled()
Determinate if Breadcrumbs are enabled. String
getBreadcrumbLogPath()
Get the location of the breadcrumb log -
-
Constructor Detail
-
BacktraceBreadcrumbs
BacktraceBreadcrumbs(String breadcrumbLogDirectory)
-
-
Method Detail
-
setOnSuccessfulBreadcrumbAddEventListener
void setOnSuccessfulBreadcrumbAddEventListener(OnSuccessfulBreadcrumbAddEventListener eventListener)
Set event executed after adding a breadcrumb to the file
- Parameters:
eventListener
- object with method which will be executed
-
getEnabledBreadcrumbTypes
EnumSet<BacktraceBreadcrumbType> getEnabledBreadcrumbTypes()
Gets the enabled breadcrumb types
-
enableBreadcrumbs
boolean enableBreadcrumbs(Context context)
Enable logging of breadcrumbs and submission with crash reports
- Parameters:
context
- context of current state of the application
-
enableBreadcrumbs
boolean enableBreadcrumbs(Context context, EnumSet<BacktraceBreadcrumbType> breadcrumbTypesToEnable)
Enable logging of breadcrumbs and submission with crash reports
- Parameters:
context
- context of current state of the applicationbreadcrumbTypesToEnable
- a set containing which breadcrumb types to enable
-
enableBreadcrumbs
boolean enableBreadcrumbs(Context context, int maxBreadcrumbLogSizeBytes)
Enable logging of breadcrumbs and submission with crash reports
- Parameters:
context
- context of current state of the applicationmaxBreadcrumbLogSizeBytes
- breadcrumb log size limit in bytes, should be a power of 2
-
enableBreadcrumbs
boolean enableBreadcrumbs(Context context, EnumSet<BacktraceBreadcrumbType> breadcrumbTypesToEnable, int maxBreadcrumbLogSizeBytes)
Enable logging of breadcrumbs and submission with crash reports
- Parameters:
context
- context of current state of the applicationbreadcrumbTypesToEnable
- a set containing which breadcrumb types to enablemaxBreadcrumbLogSizeBytes
- breadcrumb log size limit in bytes, should be a power of 2
-
clearBreadcrumbs
boolean clearBreadcrumbs()
Clear breadcrumb logs
-
setCurrentBreadcrumbId
void setCurrentBreadcrumbId(long breadcrumbId)
NOTE: This should only be used for testing
- Parameters:
breadcrumbId
- Will force set the current breadcrumb ID
-
getCurrentBreadcrumbId
long getCurrentBreadcrumbId()
Get the current breadcrumb ID (exclusive). This is useful when breadcrumbs are queued andposted to an API because in the meantime before the breadcrumbs are finally posted we mightget more breadcrumbs which are not relevant (because they occur after queueing up thebreadcrumb sender). Therefore it is useful to mark the breadcrumb sender with the mostcurrent breadcrumb ID at the time of queuing up the request to post the breadcrumbs.
-
addBreadcrumb
boolean addBreadcrumb(String message)
Add a breadcrumb of type "Manual" and level "Info" with the provided message string
-
addBreadcrumb
boolean addBreadcrumb(String message, BacktraceBreadcrumbLevel level)
Add a breadcrumb of type "Manual" and the desired level with the provided message string
-
addBreadcrumb
boolean addBreadcrumb(String message, Map<String, Object> attributes)
Add a breadcrumb of type "Manual" and level "Info" with the provided message string and attributes
-
addBreadcrumb
boolean addBreadcrumb(String message, Map<String, Object> attributes, BacktraceBreadcrumbLevel level)
Add a breadcrumb of type "Manual" and the desired level with the provided message string and attributes
-
addBreadcrumb
boolean addBreadcrumb(String message, BacktraceBreadcrumbType type)
Add a breadcrumb of the desired type and level "Info" with the provided message string
-
addBreadcrumb
boolean addBreadcrumb(String message, BacktraceBreadcrumbType type, BacktraceBreadcrumbLevel level)
Add a breadcrumb of the desired level and type with the provided message string
-
addBreadcrumb
boolean addBreadcrumb(String message, Map<String, Object> attributes, BacktraceBreadcrumbType type)
Add a breadcrumb of the desired type and level "Info" with the provided message string and attributes
-
addBreadcrumb
boolean addBreadcrumb(String message, Map<String, Object> attributes, BacktraceBreadcrumbType type, BacktraceBreadcrumbLevel level)
Add a breadcrumb of the desired level and type with the provided message string and attributes
-
processReportBreadcrumbs
void processReportBreadcrumbs(BacktraceReport backtraceReport)
If Breadcrumbs is currently enabled, process the BacktraceReport for sending the Breadcrumb logs
-
isEnabled
boolean isEnabled()
Determinate if Breadcrumbs are enabled.
-
getBreadcrumbLogPath
String getBreadcrumbLogPath()
Get the location of the breadcrumb log
-
-
-
-