Plugin for System.Diagnostics.Trace
Logify Alert provides you with a plugin that allows integrating with System.Diagnostics.Trace.
Install the Plugin
To add the plugin to the application's code, follow the steps below.
-
Select Tools | NuGet Package Manager | Package Manager Console from the Visual Studio main menu.
-
Execute the command below.
WinForms applications: Install-Package Logify.Alert.Win
Web applications: Install-Package Logify.Alert.Web
WPF applications: Install-Package Logify.Alert.Wpf
Console applications: Install-Package Logify.Alert.Console
Set Up the Plugin
Set up the plugin according to your target platform. The App.config example below demonstrates how to set up the plugin for a WinForms application.
<configuration>
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<add name="LogifyAlertTraceListener" type="DevExpress.Logify.Win.LogifyAlertTraceListener, Logify.Alert.Win" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
Send Reports
After a plugin has been set up, use the required approach (automatic or a manual sending) to report exceptions to Logify Alert. The example below demonstrates how to perform manual error reporting to Logify Alert via System.Diagnostics.Trace.
using System.Diagnostics;
using DevExpress.Logify.Win;
try {
LogifyAlert.Instance.ApiKey = "SPECIFY_YOUR_API_KEY_HERE";
RunYourCode();
}
catch (Exception e) {
Trace.TraceError("An exception occurred", e);
}
Now, each time your application traces an error via System.Diagnostics.Trace, the corresponding report is sent to Logify Alert.