SeqLoggerProvider 2.1.2

dotnet add package SeqLoggerProvider --version 2.1.2                
NuGet\Install-Package SeqLoggerProvider -Version 2.1.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SeqLoggerProvider" Version="2.1.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SeqLoggerProvider --version 2.1.2                
#r "nuget: SeqLoggerProvider, 2.1.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SeqLoggerProvider as a Cake Addin
#addin nuget:?package=SeqLoggerProvider&version=2.1.2

// Install SeqLoggerProvider as a Cake Tool
#tool nuget:?package=SeqLoggerProvider&version=2.1.2                

SeqLoggerProvider

License Continuous Deployment NuGet

An implementation of ILoggerProvider, from the .NET Extensions Logging Framework framework, for writing log entries to a Seq server.

This library provides an alternative to the official Seq logger provider, with a goal of providing a slimmer and more extensible implementation. This library includes the following key features that separate it from the official one:

  • Includes only first-party and .NET dependencies, including... -- System.Text.Json, -- System.Threading.Channels, -- Microsoft.Extensions.Http, -- Microsoft.Extensions.Configuration -- Microsoft.Extensions.DependencyInjection
  • Allows for global-scope log data, I.E. data fields that are included upon every log event sent to the server.
  • Allows for more granular control of event batching, including both size-based and time-based thresholds, and flood control
  • Provides extension points for JSON serialization, based on System.Text.Json, allowing for consumers to write custom serializers for log entries that can optimize for performance or data size.
  • Provides extension points for HTTP transmission, allowing for consumers to apply any custom configurations to the HttpClient instances that are used to deliver log entries to the Seq server.

Usage

Basic Setup

To setup the logger provider within a .NET application, simply call the setup method, while setting up your logging system. Either upon your IHostBuilder...

.ConfigureLogging(builder => builder
    .AddSeq())

...or upon your IServiceCollection...

.AddLogging(builder => builder
    .AddSeq());

Configuration

Configuration is automatically extracted from the ambient IConfiguration system, if present, in the same fashion as all first-party logger providers. For example, if you're using an appsettings.json file...

{
  "Logging": {
    "Seq": {
      "ServerUrl": "http://localhost:5341/"
      "ApiKey": "...",
      "GlobalScopeState": {
        "Application": "SeqLogger.Test"
      },
      "LogLevel": {
        "Default": "Debug",
        "SeqLoggerProvider": "None"
      }
    }
  }
}

If you would like to customize the configuration manually, the .AddSeq() method supports a standard configuration delegate being passed in...

builder.AddSeq(options =>
{
	var assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version;
	if (assemblyVersion is not null)
        options.GlobalScopeState.Add("Version", assemblyVersion.ToString();
});

All configuration properties are optional, except for ServerUrl, for obvious reasons.

JSON Customization

In order to customize JSON serialization behavior, simply supply an options configuration delegate, when adding the provider.

builder.AddSeq(configureJsonSerializer: options =>
{
    options.Converters.Add(new MyJsonConverter());
    options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
});

HTTP Customization

In order to customize HTTP transmission behavior, simply use the configureHttpClient parameter supported by the .AddSeq() method:

builder.AddSeq(configureHttpClient: builder => builder
    .RedactLoggedHeaders(new[] { SeqLoggerConstants.ApiKeyHeaderName }));
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.2 3,722 10/22/2021
2.1.1 330 9/16/2021
2.1.0 318 9/5/2021
2.0.0 349 9/5/2021
1.0.1 326 8/18/2021
1.0.0 314 8/18/2021

Implemented serialization of large numeric values to string, instead of JSON number, as a workaround for https://github.com/datalust/seq-tickets/issues/216
     Updated to latest PATCH version, for all dependencies.