SeqLoggerProvider 1.0.0
See the version list below for details.
dotnet add package SeqLoggerProvider --version 1.0.0
NuGet\Install-Package SeqLoggerProvider -Version 1.0.0
<PackageReference Include="SeqLoggerProvider" Version="1.0.0" />
paket add SeqLoggerProvider --version 1.0.0
#r "nuget: SeqLoggerProvider, 1.0.0"
// Install SeqLoggerProvider as a Cake Addin #addin nuget:?package=SeqLoggerProvider&version=1.0.0 // Install SeqLoggerProvider as a Cake Tool #tool nuget:?package=SeqLoggerProvider&version=1.0.0
StructuredLoggerMessage
An implementation of ILoggerProvider
, from the .NET Extensions Logging Framework framework, for writing log events 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 events 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 events 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 | Versions 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. |
-
.NETStandard 2.0
- BatchingLoggerProvider (>= 1.0.0)
- Microsoft.Extensions.Http (>= 5.0.0)
- Microsoft.Extensions.ObjectPool (>= 5.0.9)
- Microsoft.Extensions.Options.DataAnnotations (>= 5.0.0)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.Text.Json (>= 5.0.2)
-
.NETStandard 2.1
- BatchingLoggerProvider (>= 1.0.0)
- Microsoft.Extensions.Http (>= 5.0.0)
- Microsoft.Extensions.ObjectPool (>= 5.0.9)
- Microsoft.Extensions.Options.DataAnnotations (>= 5.0.0)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.Text.Json (>= 5.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial Release