Skip to content

Commit

Permalink
Merge pull request #57 from datalust/dev
Browse files Browse the repository at this point in the history
8.0.0 Release
  • Loading branch information
nblumhardt authored Jan 28, 2024
2 parents e7fa4e0 + f8a7ccb commit 1dad962
Show file tree
Hide file tree
Showing 82 changed files with 4,226 additions and 4,375 deletions.
30 changes: 22 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Seq.Extensions.Logging [![Build status](https://ci.appveyor.com/api/projects/status/h7r1hv3cpd6e2ou3?svg=true)](https://ci.appveyor.com/project/datalust/seq-extensions-logging) [![NuGet Pre Release](https://img.shields.io/nuget/vpre/Seq.Extensions.Logging.svg)](https://nuget.org/packages/Seq.Extensions.Logging) [![Join the chat at https://gitter.im/datalust/seq](https://img.shields.io/gitter/room/datalust/seq.svg)](https://gitter.im/datalust/seq)
# Seq.Extensions.Logging [![Build status](https://ci.appveyor.com/api/projects/status/h7r1hv3cpd6e2ou3?svg=true)](https://ci.appveyor.com/project/datalust/seq-extensions-logging) [![NuGet Pre Release](https://img.shields.io/nuget/vpre/Seq.Extensions.Logging.svg)](https://nuget.org/packages/Seq.Extensions.Logging)

[Seq](https://datalust.co/seq) is a flexible self-hosted back-end for the ASP.NET Core logging subsystem (_Microsoft.Extensions.Logging_). Log events generated by the framework and application code are sent over HTTP to a Seq server, where the structured data associated with each event is used for powerful filtering, correlation, and analysis.

Expand Down Expand Up @@ -47,7 +47,7 @@ class HomeController : Controller

Log messages will be sent to Seq in batches and be visible in the Seq user interface. Observe that correlation identifiers added by the framework, like `RequestId`, are all exposed and fully-searchable in Seq.

### Logging with message templates~~~~
### Logging with message templates

Seq supports the templated log messages used by _Microsoft.Extensions.Logging_. By writing events with _named format placeholders_, the data attached to the event preserves the individual property values.

Expand Down Expand Up @@ -114,6 +114,18 @@ var json = "{\"A\": 42}";
_logger.LogInformation("The answer is {Answer}", new JsonSafeString(json));
```

### Trace and span correlation

The Seq logger provider automatically adds trace and span ids to events when present, enabling the _Trace_ drop-down menu in Seq's expanded event view.

ASP.NET Core may add additional top-level `TraceId`, `SpanId`, and `ParentId` properties in its default configuration. You can remove these if you wish, using `ILoggingBuilder.Configure()`:

```csharp
builder.Logging.Configure(opts => {
opts.ActivityTrackingOptions = ActivityTrackingOptions.None;
});
```

### Troubleshooting

> Nothing showed up, what can I do?
Expand Down Expand Up @@ -150,11 +162,13 @@ Seq.Extensions.Logging.SelfLog.Enable(message => {
* Turn on the `SelfLog` as described above to check for connectivity problems and other issues on the client side.
* [Raise an issue](https://github.com/datalust/seq-extensions-logging/issues), ask for help on the [Seq support forum](http://docs.datalust.co/discuss) or email **[email protected]**.

### Migrating to Serilog
### Versioning policy

This package is based on a subset of the powerful [Serilog](https://serilog.net) library. Not all of the options supported by the Serilog and Seq client libraries are present in
the _Seq.Extensions.Logging_ package. Migrating to the full Serilog API however is very easy:
The major version of this package tracks the major version of its _Microsoft.Extensions.Logging_ dependency. So, if your
application (on any target runtime) is targeting `net6.0`, use the latest 6.* version of this package. Likewise, if
you're targeting `net8.0`, target a 8.* version of _Seq.Extensions.Logging_ for the best experience.

1. Install packages _Serilog_, _Serilog.Extensions.Logging_ and _Serilog.Sinks.Seq_.
2. Follow the instructions [here](https://github.com/serilog/serilog-extensions-logging) to change `AddSeq()` into `AddSerilog()` with a `LoggerConfiguration` object passed in
3. Add `WriteTo.Seq()` to the Serilog configuration as per [the example](https://github.com/serilog/serilog-sinks-seq) given for the Seq sink for Serilog
### Credits

This package is based on a subset of the powerful [Serilog](https://serilog.net) library. Not all of the options supported by the Serilog and Seq client libraries are present in
the _Seq.Extensions.Logging_ package.
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ version: '{build}'
skip_tags: true
image: Visual Studio 2022
build_script:
- ps: ./Build.ps1
- pwsh: ./Build.ps1
test: off
artifacts:
- path: artifacts/Seq.Extensions.Logging.*.nupkg
deploy:
- provider: NuGet
api_key:
secure: 5aOb6I5NRP86KkV7nlAJmgyeuXXcrkWjZZZBPCZ7kAnw33ibgSMLdoGph3NMo0Xf
secure: Urj/cvXeFTl4NjNLrRJUZ2EpSak7Jq9JfswqrNBeDpFiTjkpjzsm3CgoOr8gRSBU
skip_symbols: true
on:
branch: /^(main|dev)$/
8 changes: 4 additions & 4 deletions example/ConsoleExample/ConsoleExample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions example/WebExample/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace WebExample.Controllers;

public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
readonly ILogger<HomeController> _logger;

public HomeController(ILogger<HomeController> logger)
{
Expand All @@ -25,7 +25,7 @@ public IActionResult Index()
{
_logger.LogInformation("Events in this block have additional properties attached");
}

return View();
}

Expand Down
7 changes: 5 additions & 2 deletions example/WebExample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
builder.Services.AddControllersWithViews();

// Use the Seq logging configuration in appsettings.json
builder.Host.ConfigureLogging(loggingBuilder =>
loggingBuilder.AddSeq());
builder.Logging.AddSeq();

// Don't log redundant top-level `TraceId` and `SpanId` properties, these are handled implicitly
// by the Seq logger.
builder.Logging.Configure(opts => opts.ActivityTrackingOptions = ActivityTrackingOptions.None);

var app = builder.Build();

Expand Down
28 changes: 0 additions & 28 deletions example/WebExample/Properties/launchSettings.json

This file was deleted.

6 changes: 5 additions & 1 deletion example/WebExample/WebExample.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand All @@ -10,4 +10,8 @@
<ProjectReference Include="..\..\src\Seq.Extensions.Logging\Seq.Extensions.Logging.csproj" />
</ItemGroup>

<ItemGroup>
<None Remove="Properties\launchSettings.json" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.300",
"version": "8.0.100",
"rollForward": "latestFeature"
}
}
1 change: 1 addition & 0 deletions seq-extensions-logging.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb"&gt;&lt;ExtraRule Prefix="" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=appsettings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Datalust/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Destructurer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Enricher/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Formattable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Serilog/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Loading

0 comments on commit 1dad962

Please sign in to comment.