Skip to content

Commit 7da9569

Browse files
authored
Merge pull request #193 from serilog/supply-service-provider
Update to show new UseSerilog() overload including service provider
2 parents 5386292 + 8151912 commit 7da9569

File tree

5 files changed

+9
-14
lines changed

5 files changed

+9
-14
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,13 @@ app.UseSerilogRequestLogging(options =>
192192
You can alternatively configure Serilog inline, in `BuildWebHost()`, using a delegate as shown below:
193193

194194
```csharp
195-
.UseSerilog((hostingContext, loggerConfiguration) => loggerConfiguration
195+
.UseSerilog((hostingContext, services, loggerConfiguration) => loggerConfiguration
196196
.ReadFrom.Configuration(hostingContext.Configuration)
197197
.Enrich.FromLogContext()
198198
.WriteTo.Console())
199199
```
200200

201-
This has the advantage of making the `hostingContext`'s `Configuration` object available for [configuration of the logger](https://github.com/serilog/serilog-settings-configuration), but at the expense of losing `Exception`s raised earlier in program startup.
201+
This has the advantage of making a service provider and the `hostingContext`'s `Configuration` object available for [configuration of the logger](https://github.com/serilog/serilog-settings-configuration), but at the expense of losing `Exception`s raised earlier in program startup.
202202

203203
If this method is used, `Log.Logger` is assigned implicitly, and closed when the app is shut down.
204204

global.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"sdk": {
33
"allowPrerelease": false,
4-
"version": "3.1.100",
5-
"rollForward": "latestPatch"
4+
"version": "3.1.201",
5+
"rollForward": "latestFeature"
66
}
7-
}
7+
}

samples/InlineInitializationSample/Program.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@ public static void Main(string[] args)
1313

1414
public static IHostBuilder CreateHostBuilder(string[] args) =>
1515
Host.CreateDefaultBuilder(args)
16-
.ConfigureWebHostDefaults(webBuilder =>
17-
{
18-
webBuilder.UseStartup<Startup>();
19-
})
20-
.UseSerilog((hostingContext, loggerConfiguration) => loggerConfiguration
16+
.ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup<Startup>())
17+
.UseSerilog((hostingContext, services, loggerConfiguration) => loggerConfiguration
2118
.ReadFrom.Configuration(hostingContext.Configuration)
2219
.Enrich.FromLogContext()
2320
.WriteTo.Debug()

samples/InlineInitializationSample/Startup.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
using System.Net;
21
using Microsoft.AspNetCore.Builder;
32
using Microsoft.AspNetCore.Hosting;
43
using Microsoft.Extensions.DependencyInjection;
54
using Microsoft.Extensions.Hosting;
65
using Serilog;
7-
using Serilog.Events;
86

97
namespace InlineInitializationSample
108
{

src/Serilog.AspNetCore/Serilog.AspNetCore.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<Description>Serilog support for ASP.NET Core logging</Description>
5-
<VersionPrefix>3.3.0</VersionPrefix>
5+
<VersionPrefix>3.4.0</VersionPrefix>
66
<Authors>Microsoft;Serilog Contributors</Authors>
77
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
88
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
@@ -27,7 +27,7 @@
2727

2828
<ItemGroup>
2929
<PackageReference Include="Serilog" Version="2.9.0" />
30-
<PackageReference Include="Serilog.Extensions.Hosting" Version="3.0.0" />
30+
<PackageReference Include="Serilog.Extensions.Hosting" Version="3.1.0-dev-*" />
3131
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
3232
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
3333
<PackageReference Include="Serilog.Sinks.Debug" Version="1.0.1" />

0 commit comments

Comments
 (0)