Package io.sentry
Class Breadcrumb
- java.lang.Object
-
- io.sentry.Breadcrumb
-
- All Implemented Interfaces:
JsonSerializable
,JsonUnknown
public final class Breadcrumb extends java.lang.Object implements JsonUnknown, JsonSerializable
Series of application events
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Breadcrumb.Deserializer
static class
Breadcrumb.JsonKeys
-
Constructor Summary
Constructors Constructor Description Breadcrumb()
Breadcrumb ctorBreadcrumb(@NotNull java.util.Date timestamp)
Breadcrumb ctorBreadcrumb(@Nullable java.lang.String message)
Breadcrumb ctor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static @NotNull Breadcrumb
debug(@NotNull java.lang.String message)
Creates debug breadcrumb - typically a log message.static @NotNull Breadcrumb
error(@NotNull java.lang.String message)
Creates error breadcrumb.@Nullable java.lang.String
getCategory()
Returns the category@NotNull java.util.Map<java.lang.String,java.lang.Object>
getData()
Returns the data map@Nullable java.lang.Object
getData(@NotNull java.lang.String key)
Returns the value of data[key] or null@Nullable SentryLevel
getLevel()
Returns the SentryLevel@Nullable java.lang.String
getMessage()
Returns the message@NotNull java.util.Date
getTimestamp()
Returns the Breadcrumb's timestamp@Nullable java.lang.String
getType()
Returns the type@Nullable java.util.Map<java.lang.String,java.lang.Object>
getUnknown()
static @NotNull Breadcrumb
http(@NotNull java.lang.String url, @NotNull java.lang.String method)
Creates HTTP breadcrumb.static @NotNull Breadcrumb
http(@NotNull java.lang.String url, @NotNull java.lang.String method, @Nullable java.lang.Integer code)
Creates HTTP breadcrumb.static @NotNull Breadcrumb
info(@NotNull java.lang.String message)
Creates info breadcrumb - information that helps identify the root cause of the issue or for whom the error occurred.static @NotNull Breadcrumb
navigation(@NotNull java.lang.String from, @NotNull java.lang.String to)
Creates navigation breadcrumb - a navigation event can be a URL change in a web application, or a UI transition in a mobile or desktop application, etc.static @NotNull Breadcrumb
query(@NotNull java.lang.String message)
Creates query breadcrumb - representing a query that was made in your application.void
removeData(@NotNull java.lang.String key)
Removes an entry from the data's mapvoid
serialize(@NotNull JsonObjectWriter writer, @NotNull ILogger logger)
void
setCategory(@Nullable java.lang.String category)
Sets the categoryvoid
setData(@NotNull java.lang.String key, @NotNull java.lang.Object value)
Sets an entry to the data's mapvoid
setLevel(@Nullable SentryLevel level)
Sets the levelvoid
setMessage(@Nullable java.lang.String message)
Sets the messagevoid
setType(@Nullable java.lang.String type)
Sets the typevoid
setUnknown(@Nullable java.util.Map<java.lang.String,java.lang.Object> unknown)
static @NotNull Breadcrumb
transaction(@NotNull java.lang.String message)
Creates transaction breadcrumb - describing a tracing event.static @NotNull Breadcrumb
ui(@NotNull java.lang.String category, @NotNull java.lang.String message)
Creates ui breadcrumb - a user interaction with your app's UI.static @NotNull Breadcrumb
user(@NotNull java.lang.String category, @NotNull java.lang.String message)
Creates user breadcrumb - a user interaction with your app's UI.static @NotNull Breadcrumb
userInteraction(@NotNull java.lang.String subCategory, @Nullable java.lang.String viewId, @Nullable java.lang.String viewClass)
Creates user breadcrumb - a user interaction with your app's UI.static @NotNull Breadcrumb
userInteraction(@NotNull java.lang.String subCategory, @Nullable java.lang.String viewId, @Nullable java.lang.String viewClass, @NotNull java.util.Map<java.lang.String,java.lang.Object> additionalData)
Creates user breadcrumb - a user interaction with your app's UI.
-
-
-
Constructor Detail
-
Breadcrumb
public Breadcrumb(@NotNull @NotNull java.util.Date timestamp)
Breadcrumb ctor- Parameters:
timestamp
- the timestamp
-
Breadcrumb
public Breadcrumb()
Breadcrumb ctor
-
Breadcrumb
public Breadcrumb(@Nullable @Nullable java.lang.String message)
Breadcrumb ctor- Parameters:
message
- the message
-
-
Method Detail
-
http
@NotNull public static @NotNull Breadcrumb http(@NotNull @NotNull java.lang.String url, @NotNull @NotNull java.lang.String method)
Creates HTTP breadcrumb.- Parameters:
url
- - the request URLmethod
- - the request method- Returns:
- the breadcrumb
-
http
@NotNull public static @NotNull Breadcrumb http(@NotNull @NotNull java.lang.String url, @NotNull @NotNull java.lang.String method, @Nullable @Nullable java.lang.Integer code)
Creates HTTP breadcrumb.- Parameters:
url
- - the request URLmethod
- - the request methodcode
- - the code result. Code can be null when http request did not finish or ended with network error- Returns:
- the breadcrumb
-
navigation
@NotNull public static @NotNull Breadcrumb navigation(@NotNull @NotNull java.lang.String from, @NotNull @NotNull java.lang.String to)
Creates navigation breadcrumb - a navigation event can be a URL change in a web application, or a UI transition in a mobile or desktop application, etc.- Parameters:
from
- - the original application state / locationto
- - the new application state / location- Returns:
- the breadcrumb
-
transaction
@NotNull public static @NotNull Breadcrumb transaction(@NotNull @NotNull java.lang.String message)
Creates transaction breadcrumb - describing a tracing event.- Parameters:
message
- - the message- Returns:
- the breadcrumb
-
debug
@NotNull public static @NotNull Breadcrumb debug(@NotNull @NotNull java.lang.String message)
Creates debug breadcrumb - typically a log message. The data part is entirely undefined and as such, completely rendered as a key/value table.- Parameters:
message
- - the message- Returns:
- the breadcrumb
-
error
@NotNull public static @NotNull Breadcrumb error(@NotNull @NotNull java.lang.String message)
Creates error breadcrumb.- Parameters:
message
- - the message- Returns:
- the breadcrumb
-
info
@NotNull public static @NotNull Breadcrumb info(@NotNull @NotNull java.lang.String message)
Creates info breadcrumb - information that helps identify the root cause of the issue or for whom the error occurred.- Parameters:
message
- - the message- Returns:
- the breadcrumb
-
query
@NotNull public static @NotNull Breadcrumb query(@NotNull @NotNull java.lang.String message)
Creates query breadcrumb - representing a query that was made in your application.- Parameters:
message
- - the message- Returns:
- the breadcrumb
-
ui
@NotNull public static @NotNull Breadcrumb ui(@NotNull @NotNull java.lang.String category, @NotNull @NotNull java.lang.String message)
Creates ui breadcrumb - a user interaction with your app's UI.- Parameters:
category
- - the category, for example "click"message
- - the message- Returns:
- the breadcrumb
-
user
@NotNull public static @NotNull Breadcrumb user(@NotNull @NotNull java.lang.String category, @NotNull @NotNull java.lang.String message)
Creates user breadcrumb - a user interaction with your app's UI.- Parameters:
message
- - the message- Returns:
- the breadcrumb
-
userInteraction
@NotNull public static @NotNull Breadcrumb userInteraction(@NotNull @NotNull java.lang.String subCategory, @Nullable @Nullable java.lang.String viewId, @Nullable @Nullable java.lang.String viewClass)
Creates user breadcrumb - a user interaction with your app's UI. The breadcrumb can contain additional data likeviewId
orviewClass
. By default, the breadcrumb is captured withSentryLevel
INFO level.- Parameters:
subCategory
- - the category, for example "click"viewId
- - the human-readable view id, for example "button_load"viewClass
- - the fully qualified class name, for example "android.widget.Button"- Returns:
- the breadcrumb
-
userInteraction
@NotNull public static @NotNull Breadcrumb userInteraction(@NotNull @NotNull java.lang.String subCategory, @Nullable @Nullable java.lang.String viewId, @Nullable @Nullable java.lang.String viewClass, @NotNull @NotNull java.util.Map<java.lang.String,java.lang.Object> additionalData)
Creates user breadcrumb - a user interaction with your app's UI. The breadcrumb can contain additional data likeviewId
orviewClass
. By default, the breadcrumb is captured withSentryLevel
INFO level.- Parameters:
subCategory
- - the category, for example "click"viewId
- - the human-readable view id, for example "button_load"viewClass
- - the fully qualified class name, for example "android.widget.Button"additionalData
- - additional properties to be put into the data bag- Returns:
- the breadcrumb
-
getTimestamp
@NotNull public @NotNull java.util.Date getTimestamp()
Returns the Breadcrumb's timestamp- Returns:
- the timestamp
-
getMessage
@Nullable public @Nullable java.lang.String getMessage()
Returns the message- Returns:
- the message
-
setMessage
public void setMessage(@Nullable @Nullable java.lang.String message)
Sets the message- Parameters:
message
- the message
-
getType
@Nullable public @Nullable java.lang.String getType()
Returns the type- Returns:
- the type
-
setType
public void setType(@Nullable @Nullable java.lang.String type)
Sets the type- Parameters:
type
- the type
-
getData
@Internal @NotNull public @NotNull java.util.Map<java.lang.String,java.lang.Object> getData()
Returns the data map- Returns:
- the data map
-
getData
@Nullable public @Nullable java.lang.Object getData(@NotNull @NotNull java.lang.String key)
Returns the value of data[key] or null- Parameters:
key
- the key- Returns:
- the value or null
-
setData
public void setData(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.Object value)
Sets an entry to the data's map- Parameters:
key
- the keyvalue
- the value
-
removeData
public void removeData(@NotNull @NotNull java.lang.String key)
Removes an entry from the data's map- Parameters:
key
- the key
-
getCategory
@Nullable public @Nullable java.lang.String getCategory()
Returns the category- Returns:
- the category
-
setCategory
public void setCategory(@Nullable @Nullable java.lang.String category)
Sets the category- Parameters:
category
- the category
-
getLevel
@Nullable public @Nullable SentryLevel getLevel()
Returns the SentryLevel- Returns:
- the level
-
setLevel
public void setLevel(@Nullable @Nullable SentryLevel level)
Sets the level- Parameters:
level
- the level
-
getUnknown
@Nullable public @Nullable java.util.Map<java.lang.String,java.lang.Object> getUnknown()
- Specified by:
getUnknown
in interfaceJsonUnknown
-
setUnknown
public void setUnknown(@Nullable @Nullable java.util.Map<java.lang.String,java.lang.Object> unknown)
- Specified by:
setUnknown
in interfaceJsonUnknown
-
serialize
public void serialize(@NotNull @NotNull JsonObjectWriter writer, @NotNull @NotNull ILogger logger) throws java.io.IOException
- Specified by:
serialize
in interfaceJsonSerializable
- Throws:
java.io.IOException
-
-