Breadcrumbs .NET Framework
Breadcrumbs let you provide logging points in your code that will be collected and sent along with any exception sent to Raygun. This lets you have a better understanding of the events that happened in the system that lead up to the exception.
Recording a Breadcrumb
To record a basic breadcrumb with a custom message using the RecordBreadcrumb(string message)
method.
RaygunClient.RecordBreadcrumb("Example breadcrumb")
note:
When using the RecordBreadcrumb
method all other properties will be set to defaults.
Customizing Breadcrumb
To change a breadcrumbs level, category or attach custom data to you need first construct a Breadcrumb
object yourself and then pass it to the RecordBreadcrumb
method.
var crumb = new RaygunBreadcrumb();
// Customizable fields: These are optional
crumb.Message = "Breadcrumb message";
crumb.LineNumber = 3;
crumb.ClassName = "foo";
crumb.MethodName = "bar";
crumb.CustomData.Add("Key", "Value");
// Valid RaygunBreadcrumbLevel's are: Debug, Info, Warning and Error
crumb.Level = RaygunBreadcrumbLevel.Debug;
RaygunClient.RecordBreadcrumb(crumb);
RaygunSettings
There are two settings related to breadcrumbs which can be specified in the RaygunSettings configuration.
Breadcrumb level
You can set a breadcrumbsLevel
to either Debug, Info, Warning, or Error. This is the same as a log level in something like log4net.
Location recording
When breadcrumbsLocationRecordingEnabled
is set to true, Raygun4Net will include the class and method where the breadcrumb was logged from. This has a performance cost associated with it so it is only recommended to be enabled when needed.