Plugin for Serilog

Logify Alert provides you with a plugin that allows integrating Logify reports with Serilog logs.

Install the Plugin

To add the plugin to the application's code, follow the steps below.

  1. Select Tools | NuGet Package Manager | Package Manager Console from the Visual Studio main menu.

  2. Execute the command below.

    Install-Package Logify.Alert.Serilog

  3. 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.

        <section name="logifyAlert" type="DevExpress.Logify.LogifyConfigSection, Logify.Alert.Win" />
        <apiKey value="SPECIFY_YOUR_API_KEY_HERE" />
        <confirmSend value="false" />
            <add key="MACHINE_NAME" value="My Server" />

Register a Sink

Register the LogifyAlert target as a custom Serilog sink as follows. The example below demonstrates how to set up the plugin for a WinForms application.

using Serilog; using DevExpress.Logify.Win; LogifyAlert client = LogifyAlert.Instance; Log.Logger = new LoggerConfiguration().WriteTo.LogifyAlert().CreateLogger();

Now, each time your application sends an Error or a Fatal message with non-empty LogEvent.Exception parameter to the Serilog system, a new report is generated and sent to Logify Alert. For example:

Log.Logger.Error(new Exception("Test Logify exception"), "Test message");

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