DOCUMENTATION

Add Custom Data to Reports

Logify Alert allows you to add either a custom text (aka custom data) or an entire file (aka attachment) to a report sent to the server. This document describes how to do this for the WinForms, Web and WPF clients.


For information on how to add custom data to reports when working with the JavaScript and Node.js clients, refer to the JavaScript (JS) Client and Node.js Client documents, respectively.

Custom Data

To add the required text (for example, a user name, computer information, etc.) to a report, do any of the following.

  • Set the client's CustomData property in code...

    LogifyAlert client = LogifyAlert.Instance; client.ApiKey = "SPECIFY_YOUR_API_KEY_HERE"; // The name can only consists of a-z, A-Z, 0-9, and _ characters. client.CustomData["CustomerName"] = "Mary"; client.StartExceptionsHandling();

    ... or in a configuration file.

    <configuration>   <configSections>     ...     <!--The line below depends on your application's platform. The example corresponds to ASP.NET applications.-->     <section name="logifyAlert" type="DevExpress.Logify.WebLogifyConfigSection, Logify.Alert.Web"/>     ...   </configSections>   ...   <logifyAlert>     <apiKey value="SPECIFY_YOUR_API_KEY_HERE"/>     <customData>       <add key="CustomerName" value="Mary" />       ...     <customData/>   </logifyAlert> </configuration>

  • Pass the required custom data to the client's Send method as a parameter.

    try {   RunCode(); }
    catch (Exception e) {   var data = new Dictionary<String, String>();   data["FailedOperation"] = "RunCode";   client.Send(e, data); }

View Custom Data

After the text has been added and sent to the server, custom data is shown in the corresponding section of the received report's Report Details page. If the attached text contains more than 40 symbols, the Custom Data section shows additional icons for downloading custom data and for viewing it in a new tab.

Use Tags

Also, Logify Alert allows you to use custom data fields in:

For this purpose, use the Tags setting as listed in the Search Reports by Custom Data article.

Attachments

To add an attachment (file) to a report, create and define an instance of the DevExpress.Logify.Core.Attachment class, and then do one of the following.

  • Add the Attachment object to the client's Attachments property.

    using DevExpress.Logify.Core; using DevExpress.Logify.Win; LogifyAlert client = LogifyAlert.Instance; client.ApiKey = "SPECIFY_YOUR_API_KEY_HERE"; Attachment newAt = new Attachment(); newAt.Name = "My attachment's unique name"; newAt.Content = File.ReadAllBytes(@"C:\Work\Image_to_attach.jpg"); newAt.MimeType = "image/jpeg"; // We strongly recommend that you specify the attachment type. client.Attachments.Add(newAt); client.StartExceptionsHandling();

  • Add the Attachment object to the DevExpress.Logify.Core.AttachmentCollection collection and pass this collection to the client’s Send method as a parameter.

    using DevExpress.Logify.Core; using DevExpress.Logify.Win; try {   RunCode(); }
    catch (Exception e) {   var data = new Dictionary<String, String>();   data["FailedOperation"] = "RunCode";   Attachment newAt = new Attachment();   newAt.Name = "My attachment's unique name";   newAt.Content = File.ReadAllBytes(@"C:\Work\Image_to_attach.jpg");   // We strongly recommend that you specify the attachment type.   newAt.MimeType = "image/jpeg";   AttachmentCollection newCol = new AttachmentCollection();   newCol.Add(newAt);   client.Send(e, data, newCol); }

Important notes: The size of total attachments must not be more than 3 Mb per one crash report. The attachment name must be unique within one crash report.

After the file has been attached and sent to the server, the attachment is shown in the corresponding section of the received report's Report Details page. To download the attachment, click its name in the Attachments section.

Terms of use Copyright © 2016-2019 Developer Express Inc.