Documentation
DocumentationDiscussions
These docs are for v2. Click to read the latest docs for v2024.2.

Using SLAB

The Semantic Logging Application Block (SLAB) from Microsoft's Patterns & Practices team is an alternative structured logger that can write to Seq.

👍

Serilog or SLAB?

Serilog and SLAB each have their own strengths that may influence your decision to use one or the other. Serilog is a "schemaless" logger, which offers additional flexibility and requires fewer lines of code to use, while SLAB incorporates the schema-based approach from Windows' ETL infrastructure, and integrates strongly with it.

Installing the Sink

In your application that uses SLAB, install the Seq sink from NuGet:

At the Visual Studio Package Manager console, type:

PM> Install-Package Seq.Client.Slab

This will add the required assemblies to the project.

Now, use the LogToSeq() method to configure an event listener:

listener.LogToSeq("http://my-seq");

The method accepts the URL of your Seq server, and additional parameters like the Seq API key.

Writing Events

That's it! When you write log events to your SLAB log:

SampleEventSource.Log.Greeting(Environment.UserName)

They'll appear beautifully in Seq, complete with queryable properties from the payload and ETW.