Enhance Crash Reports¶
At times, even full stack traces aren’t quite enough to pinpoint the bug. To give you even more insight, Crashlytics provides four logging mechanisms right out of the box: custom keys, custom logs, user identifers, and caught exceptions (see the Caught Exceptions page).
Crashlytics allows you to associate arbitrary key/value pairs with your crash reports, which are viewable right from the Fabric dashboard. A key can be set using the following method in your C# code:
Crashlytics.SetKeyValue(string key, string value);
Re-setting the same key will update the value:
Crashlytics.SetKeyValue("current_level", "3"); Crashlytics.SetKeyValue("current_level", "4");
Crashlytics supports a maximum of 64 key/value pairs. Once you reach this threshold, additional values are not saved. Each key/value pair can be up to 1 KB in size.
Logged messages are associated with your crash data and are visible in the Crashlytics dashboard if you look at the specific crash itself.
To log messages with crash data, call the following method from your C# code:
To make sure that sending crash reports has the smallest impact on your user’s devices, Crashlytics logs have a maximum size of 64 KB. When a log exceeds 64 KB, the earliest logged values will be dropped in order to maintain this threshold.
It’s often helpful to know which of your users experienced a given crash. A user identifier can be set in your C# code using the following method.
An ID number, token, or hashed value can be used to uniquely identify the end-user of your application without disclosing or transmitting any of their personal information. You can also clear the value by setting it to a blank string. This value is displayed in the Fabric dashboard when looking at a specific crash. Two other related APIs also allow you to include a name and email address:
Crashlytics.SetUserEmail(string email); Crashlytics.SetUserName(string name);