Class BacktraceBreadcrumbs

  • All Implemented Interfaces:
    Breadcrumbs

    public class BacktraceBreadcrumbs
    extends java.lang.Object
    implements Breadcrumbs
    • Field Detail

      • DEFAULT_MAX_LOG_SIZE_BYTES

        public static final int DEFAULT_MAX_LOG_SIZE_BYTES
        See Also:
        Constant Field Values
    • Constructor Detail

      • BacktraceBreadcrumbs

        public BacktraceBreadcrumbs​(java.lang.String breadcrumbLogDirectory)
    • Method Detail

      • enableBreadcrumbs

        public boolean enableBreadcrumbs​(android.content.Context context)
        Description copied from interface: Breadcrumbs
        Enable logging of breadcrumbs and submission with crash reports
        Specified by:
        enableBreadcrumbs in interface Breadcrumbs
        Parameters:
        context - context of current state of the application
        Returns:
        true if we successfully enabled breadcrumbs
      • enableBreadcrumbs

        public boolean enableBreadcrumbs​(android.content.Context context,
                                         java.util.EnumSet<BacktraceBreadcrumbType> breadcrumbTypesToEnable)
        Description copied from interface: Breadcrumbs
        Enable logging of breadcrumbs and submission with crash reports
        Specified by:
        enableBreadcrumbs in interface Breadcrumbs
        Parameters:
        context - context of current state of the application
        breadcrumbTypesToEnable - a set containing which breadcrumb types to enable
        Returns:
        true if we successfully enabled breadcrumbs
      • enableBreadcrumbs

        public boolean enableBreadcrumbs​(android.content.Context context,
                                         int maxBreadcrumbLogSizeBytes)
        Description copied from interface: Breadcrumbs
        Enable logging of breadcrumbs and submission with crash reports
        Specified by:
        enableBreadcrumbs in interface Breadcrumbs
        Parameters:
        context - context of current state of the application
        maxBreadcrumbLogSizeBytes - breadcrumb log size limit in bytes, should be a power of 2
        Returns:
        true if we successfully enabled breadcrumbs
      • enableBreadcrumbs

        public boolean enableBreadcrumbs​(android.content.Context context,
                                         java.util.EnumSet<BacktraceBreadcrumbType> breadcrumbTypesToEnable,
                                         int maxBreadcrumbLogSizeBytes)
        Description copied from interface: Breadcrumbs
        Enable logging of breadcrumbs and submission with crash reports
        Specified by:
        enableBreadcrumbs in interface Breadcrumbs
        Parameters:
        context - context of current state of the application
        breadcrumbTypesToEnable - a set containing which breadcrumb types to enable
        maxBreadcrumbLogSizeBytes - breadcrumb log size limit in bytes, should be a power of 2
        Returns:
        true if we successfully enabled breadcrumbs
      • clearBreadcrumbs

        public boolean clearBreadcrumbs()
        Description copied from interface: Breadcrumbs
        Clear breadcrumb logs
        Specified by:
        clearBreadcrumbs in interface Breadcrumbs
        Returns:
        true if log was successfully cleared
      • setCurrentBreadcrumbId

        public void setCurrentBreadcrumbId​(long breadcrumbId)
        NOTE: This should only be used for testing
        Specified by:
        setCurrentBreadcrumbId in interface Breadcrumbs
        Parameters:
        breadcrumbId - Will force set the current breadcrumb ID
      • getCurrentBreadcrumbId

        public long getCurrentBreadcrumbId()
        Get the current breadcrumb ID (exclusive). This is useful when breadcrumbs are queued and posted to an API because in the meantime before the breadcrumbs are finally posted we might get more breadcrumbs which are not relevant (because they occur after queueing up the breadcrumb sender). Therefore it is useful to mark the breadcrumb sender with the most current breadcrumb ID at the time of queuing up the request to post the breadcrumbs.
        Specified by:
        getCurrentBreadcrumbId in interface Breadcrumbs
        Returns:
        current breadcrumb ID (exclusive)
      • addBreadcrumb

        public boolean addBreadcrumb​(java.lang.String message)
        Add a breadcrumb of type "Manual" and level "Info" with the provided message string
        Specified by:
        addBreadcrumb in interface Breadcrumbs
        Parameters:
        message -
        Returns:
        true if the breadcrumb was successfully added
      • addBreadcrumb

        public boolean addBreadcrumb​(java.lang.String message,
                                     BacktraceBreadcrumbLevel level)
        Add a breadcrumb of type "Manual" and the desired level with the provided message string
        Specified by:
        addBreadcrumb in interface Breadcrumbs
        Parameters:
        message -
        level -
        Returns:
        true if the breadcrumb was successfully added
      • addBreadcrumb

        public boolean addBreadcrumb​(java.lang.String message,
                                     java.util.Map<java.lang.String,​java.lang.Object> attributes)
        Add a breadcrumb of type "Manual" and level "Info" with the provided message string and attributes
        Specified by:
        addBreadcrumb in interface Breadcrumbs
        Parameters:
        message -
        attributes -
        Returns:
        true if the breadcrumb was successfully added
      • addBreadcrumb

        public boolean addBreadcrumb​(java.lang.String message,
                                     java.util.Map<java.lang.String,​java.lang.Object> attributes,
                                     BacktraceBreadcrumbLevel level)
        Add a breadcrumb of type "Manual" and the desired level with the provided message string and attributes
        Specified by:
        addBreadcrumb in interface Breadcrumbs
        Parameters:
        message -
        attributes -
        level -
        Returns:
        true if the breadcrumb was successfully added
      • addBreadcrumb

        public boolean addBreadcrumb​(java.lang.String message,
                                     BacktraceBreadcrumbType type)
        Add a breadcrumb of the desired type and level "Info" with the provided message string
        Specified by:
        addBreadcrumb in interface Breadcrumbs
        Parameters:
        message -
        type -
        Returns:
        true if the breadcrumb was successfully added
      • addBreadcrumb

        public boolean addBreadcrumb​(java.lang.String message,
                                     BacktraceBreadcrumbType type,
                                     BacktraceBreadcrumbLevel level)
        Add a breadcrumb of the desired level and type with the provided message string
        Specified by:
        addBreadcrumb in interface Breadcrumbs
        Parameters:
        message -
        type -
        level -
        Returns:
        true if the breadcrumb was successfully added
      • addBreadcrumb

        public boolean addBreadcrumb​(java.lang.String message,
                                     java.util.Map<java.lang.String,​java.lang.Object> attributes,
                                     BacktraceBreadcrumbType type)
        Add a breadcrumb of the desired type and level "Info" with the provided message string and attributes
        Specified by:
        addBreadcrumb in interface Breadcrumbs
        Parameters:
        message -
        attributes -
        type -
        Returns:
        true if the breadcrumb was successfully added
      • addBreadcrumb

        public boolean addBreadcrumb​(java.lang.String message,
                                     java.util.Map<java.lang.String,​java.lang.Object> attributes,
                                     BacktraceBreadcrumbType type,
                                     BacktraceBreadcrumbLevel level)
        Add a breadcrumb of the desired level and type with the provided message string and attributes
        Specified by:
        addBreadcrumb in interface Breadcrumbs
        Parameters:
        message -
        attributes -
        type -
        level -
        Returns:
        true if the breadcrumb was successfully added
      • processReportBreadcrumbs

        public void processReportBreadcrumbs​(BacktraceReport backtraceReport)
        If Breadcrumbs is currently enabled, process the BacktraceReport for sending the Breadcrumb logs
        Specified by:
        processReportBreadcrumbs in interface Breadcrumbs
        Parameters:
        backtraceReport -
      • isEnabled

        public boolean isEnabled()
        Determinate if Breadcrumbs are enabled.
        Specified by:
        isEnabled in interface Breadcrumbs
        Returns:
        true if breadcrumbs are enabled.
      • getBreadcrumbLogPath

        public java.lang.String getBreadcrumbLogPath()
        Description copied from interface: Breadcrumbs
        Get the location of the breadcrumb log
        Specified by:
        getBreadcrumbLogPath in interface Breadcrumbs
        Returns:
        Location of the breadcrumb log