Teqit.Extensions.Seq
3.2.0
dotnet add package Teqit.Extensions.Seq --version 3.2.0
NuGet\Install-Package Teqit.Extensions.Seq -Version 3.2.0
<PackageReference Include="Teqit.Extensions.Seq" Version="3.2.0" />
<PackageVersion Include="Teqit.Extensions.Seq" Version="3.2.0" />
<PackageReference Include="Teqit.Extensions.Seq" />
paket add Teqit.Extensions.Seq --version 3.2.0
#r "nuget: Teqit.Extensions.Seq, 3.2.0"
#:package Teqit.Extensions.Seq@3.2.0
#addin nuget:?package=Teqit.Extensions.Seq&version=3.2.0
#tool nuget:?package=Teqit.Extensions.Seq&version=3.2.0
Microsoft Dependency Injection extensions for SEQ
This project produces a NuGet URL. Visit at https://www.nuget.org/packages/Teqit.Extensions.Seq/.
Use this package during your start-up to write logging to SEQ.
It comes with a lot of enrichments by default:
- environment name,
- environment username,
- machine name,
- process Id,
- process name,
- thread Id,
- thread name.
By running the bare minimum of this package the log events will be sent as verbose to http://localhost:5341 without api key.
Changelog
3.2.0
- Fix:
levelnow also sets the logger's minimum level. Before, Debug and Verbose events were dropped because the Serilog minimum stayed at Information. The default (Verbose) is now effective: passlevel: LogEventLevel.Informationfor the previous volume. - Add the
Applicationproperty (from IHostEnvironment.ApplicationName) andEnrich.FromLogContext(). - Add
ReadFrom.Services, so ILogEventEnricher/ILogEventSink registered in DI are picked up. - Add optional
writeToProviders(forward events to other ILoggerProviders such as OpenTelemetry) andconfigure(extra Serilog configuration, e.g. MinimumLevel.Override).
3.1.0
- Upgrade packages
- Fix missing extensions summary params
3.0.0
- Convert to .NET Standard project
- Support .NET 10.
2.0.0 Add log to file support.
1.1.0 Add default docker URL support.
1.0.3 Update readme and summary and add project URL.
1.0.2 Add apikey support and add summary for extension method
1.0.1 Add readme
1.0.0 Initial setup
Example
The default extension method acccepts nullable parameters, and thus can be used without any parameters.
using Teqit.Extensions.Seq;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSeq();
If you have SEQ running on a specific URL and port, then specify it like so:
using Teqit.Extensions.Seq;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSeq("https://company.io:5341/");
If you want to log only errors, then specify it like so:
using Serilog;
using Teqit.Extensions.Seq;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSeq(level: Serilog.Events.LogEventLevel.Error);
If you want to use an API key, then specify it like so:
using Teqit.Extensions.Seq;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSeq(apiKey: "01234567890123456789");
Add the following to your built WebApplication object if you want request logging to appear in SEQ:
using Serilog;
using Teqit.Extensions.Seq;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSeq();
var app = builder.Build();
app.UseSerilogRequestLogging();
If you have SEQ running as a Docker container and want to use the default host.docker.internal URL, then specify it like so:
using Teqit.Extensions.Seq;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSeq(useDefaultDockerContainerUrl: true);
Log levels
level is the only level filter. Because Serilog replaces the ILoggerFactory, the Logging:LogLevel section of
appsettings does not apply to these events. Use configure for per-category overrides:
builder.Services.AddSeq(
level: LogEventLevel.Debug,
configure: cfg => cfg.MinimumLevel.Override("Microsoft.AspNetCore.Server.Kestrel", LogEventLevel.Information));
OpenTelemetry / other providers
By default Serilog replaces the logging pipeline, so other ILoggerProviders (for example OpenTelemetry) receive no
events. Pass writeToProviders: true to forward events to them as well. The host's built-in console provider then
prints in addition to this package's Console sink, so call builder.Logging.ClearProviders() before registering
your own providers:
builder.Logging.ClearProviders();
builder.Logging.AddOpenTelemetry(/* ... */);
builder.Services.AddSeq(writeToProviders: true);
| 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.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 was computed. |
| .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
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.14)
- Serilog.AspNetCore (>= 10.0.0)
- Serilog.Enrichers.Environment (>= 3.0.1)
- Serilog.Enrichers.Process (>= 3.0.0)
- Serilog.Enrichers.Thread (>= 4.0.0)
- Serilog.Sinks.Seq (>= 9.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
3.2.0: `level` now also sets the logger minimum level (the default Verbose is now effective; pass level: LogEventLevel.Information for the previous volume). Adds the Application property, Enrich.FromLogContext, ReadFrom.Services and the optional writeToProviders and configure parameters.