Skip to content

Commit 3599831

Browse files
authored
Merge pull request #52 from datalust/dev
6.1.0 Release
2 parents d9a9039 + 06d2978 commit 3599831

File tree

143 files changed

+65137
-14419
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+65137
-14419
lines changed

Build.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ foreach ($src in ls src/*) {
2121
echo "build: Packaging project in $src"
2222

2323
if ($suffix) {
24-
& dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix --include-source
24+
& dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix
2525
} else {
26-
& dotnet pack -c Release -o ..\..\artifacts --include-source
26+
& dotnet pack -c Release -o ..\..\artifacts
2727
}
2828

2929
if($LASTEXITCODE -ne 0) { exit 1 }

README.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,20 @@ This package makes it a one-liner to configure ASP.NET Core logging with Seq.
1010

1111
### Getting started
1212

13-
The instructions that follow are for **.NET Core 2.0+**.
13+
The instructions that follow are for **.NET 6.0+** web applications.
1414

1515
Add [the NuGet package](https://nuget.org/packages/seq.extensions.logging) to your project either by editing the CSPROJ file, or using the NuGet package manager:
1616

1717
```
1818
dotnet add package Seq.Extensions.Logging
1919
```
2020

21-
In `Startup.cs`, call `AddSeq()` on the provided `ILoggingBuilder`.
21+
In `Program.cs`, call `AddSeq()` on the host's `ILoggingBuilder`.
2222

2323
```csharp
24-
public class Startup
25-
{
26-
public void ConfigureServices(IServiceCollection services)
27-
{
28-
// Added; requires `using Microsoft.Extensions.Logging;`
29-
services.AddLogging(builder => builder.AddSeq())
30-
31-
// Other configuration follows...
32-
}
33-
}
24+
// Use the Seq logging configuration in appsettings.json
25+
builder.Host.ConfigureLogging(loggingBuilder =>
26+
loggingBuilder.AddSeq());
3427
```
3528

3629
The framework will inject `ILogger` instances into controllers and other classes:
@@ -54,7 +47,7 @@ class HomeController : Controller
5447

5548
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.
5649

57-
### Logging with message templates
50+
### Logging with message templates~~~~
5851

5952
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.
6053

@@ -109,7 +102,17 @@ In `appsettings.json` add a `"Seq"` property to `"Logging"` to configure the ser
109102

110103
### Dynamic log level control
111104

112-
The logging provider will dynamically adjust the default logging level up or down based on the level associated with an API key in Seq. For further information see the [Seq documentation](http://docs.datalust.co/docs/using-serilog#dynamic-level-control).
105+
The logging provider will dynamically adjust the default logging level up or down based on the level associated with an API key in Seq. For further information see
106+
the [Seq documentation](http://docs.datalust.co/docs/using-serilog#dynamic-level-control).
107+
108+
### Including literal JSON strings in log events
109+
110+
The logging provider ships with a `JsonSafeString` type that can be used to communicate to the logger that a string contains valid JSON, which can be safely included in a log event as structured data.
111+
112+
```csharp
113+
var json = "{\"A\": 42}";
114+
_logger.LogInformation("The answer is {Answer}", new JsonSafeString(json));
115+
```
113116

114117
### Troubleshooting
115118

@@ -149,7 +152,8 @@ Seq.Extensions.Logging.SelfLog.Enable(message => {
149152

150153
### Migrating to Serilog
151154

152-
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:
155+
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
156+
the _Seq.Extensions.Logging_ package. Migrating to the full Serilog API however is very easy:
153157

154158
1. Install packages _Serilog_, _Serilog.Extensions.Logging_ and _Serilog.Sinks.Seq_.
155159
2. Follow the instructions [here](https://github.com/serilog/serilog-extensions-logging) to change `AddSeq()` into `AddSerilog()` with a `LoggerConfiguration` object passed in

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: '{build}'
22
skip_tags: true
3-
image: Visual Studio 2019
3+
image: Visual Studio 2022
44
build_script:
55
- ps: ./Build.ps1
66
test: off
@@ -9,7 +9,7 @@ artifacts:
99
deploy:
1010
- provider: NuGet
1111
api_key:
12-
secure: QYBIGd/prsJud8qlJati9FdnXbiA0VvyxO1z0TUiQV3svdpbD7ZaykJFTYKyIdQq
12+
secure: 5aOb6I5NRP86KkV7nlAJmgyeuXXcrkWjZZZBPCZ7kAnw33ibgSMLdoGph3NMo0Xf
1313
skip_symbols: true
1414
on:
1515
branch: /^(main|dev)$/

example/ConsoleApplication/Program.cs

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net5.0</TargetFramework>
5+
<TargetFramework>net6.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
68
</PropertyGroup>
7-
9+
810
<ItemGroup>
9-
<ProjectReference Include="..\..\src\Seq.Extensions.Logging\Seq.Extensions.Logging.csproj" />
11+
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
12+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
13+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
1014
</ItemGroup>
1115

1216
<ItemGroup>
13-
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.0.1" />
14-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.0.1" />
17+
<ProjectReference Include="..\..\src\Seq.Extensions.Logging\Seq.Extensions.Logging.csproj" />
1518
</ItemGroup>
1619

1720
</Project>

example/ConsoleExample/Program.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using Microsoft.Extensions.DependencyInjection;
2+
using Microsoft.Extensions.Logging;
3+
4+
using var services = new ServiceCollection()
5+
.AddLogging(builder => builder
6+
.AddConsole()
7+
.AddSeq())
8+
.BuildServiceProvider();
9+
10+
var logger = services.GetRequiredService<ILogger<Program>>();
11+
12+
logger.LogInformation("Hello, {Name}!", Environment.UserName);

example/WebApplication/.bowerrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

example/WebApplication/Controllers/HomeController.cs

Lines changed: 0 additions & 54 deletions
This file was deleted.

example/WebApplication/Program.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)