Capture Serilog Data with Loupe
Serilog is a common, well-regarded Structured Logging API for .NET. It’s designed to help applications record well-formatted log messages and name/value pairs to enable more advanced operations like filtering by the values recorded. It supports writing log data to multiple log storage systems ranging from simple text files to centralized logging systems.
Serilog provides sophisticated features like filtering by severity level, custom formatting, and additional contextual information captured automatically for events.
Loupe integrates with Serilog by providing a custom Sink, capturing everything you’re already sending to Serilog, and extending it with Loupe’s additional data.
How the Loupe Agent works with Serilog
Loupe connects through the Loupe Agent for Serilog. This allows it to work beside existing sinks, so you can try Loupe in parallel with your existing log storage techniques.
Using Loupe as a Serilog Viewer is easy - just add the correct NuGet package and a few lines of code to connect Loupe and Serilog.
- Loupe.Serilog - For use with .NET Framework applications.
- Loupe.Serilog.Core - For use with .NET Standard and .Net Core applications (including .NET 6).
Once you’ve added the reference, register the Loupe sink like this:
Log.Logger = new LoggerConfiguration()
.WriteTo.Loupe() //The call to .Loupe() is the only change
.CreateLogger();
Like the Loupe Agent, the Loupe Serilog package is open-source on GitHub.
Viewing Serilog Logs Using Loupe
By adding Loupe to your existing application, all of the custom messages you’ve created are merged with the additional data Loupe captures. There are two different ways to view this data:
-
Loupe Desktop. This is our completely free desktop log viewer. Use it for live log viewing and metric tracking. It also works with our centralized logging system.
-
Loupe Server. Online Centralized Logging. All your logs are viewable from any computer that can run a browser. It also includes metric data views and application defect tracking.
Either platform accepts Serilog logs and completely takes care of formatting the data. This way, you can rely less on configuring items directly in your application code, and just let Loupe do it for you.
Within minutes you can be getting notifications of each unique error reported in your application, with all the tools you need to manage those issues and support your users. If you want to get started with Loupe with Serilog, give it a try using Loupe Desktop in the link below.