Skip to content

Commit

Permalink
Merge pull request #104 from nblumhardt/split-hosting
Browse files Browse the repository at this point in the history
Split out the ASP.NET Core 2.0 host integration
  • Loading branch information
merbla authored Aug 28, 2017
2 parents 5e359d9 + 85570a5 commit 8f8d105
Show file tree
Hide file tree
Showing 14 changed files with 10 additions and 350 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@

A Serilog provider for [Microsoft.Extensions.Logging](https://www.nuget.org/packages/Microsoft.Extensions.Logging), the logging subsystem used by ASP.NET Core.

This package routes ASP.NET log messages through Serilog, so you can get information about ASP.NET's internal operations logged to the same Serilog sinks as your application events.
### ASP.NET Core 2.0+ Instructions

### Instructions
ASP.NET Core 2.0 applications should prefer [Serilog.AspNetCore](https://github.com/serilog/serilog-aspnetcore) and `UseSerilog()` instead.

**First**, install the _Serilog.Extensions.Logging_ [NuGet package](https://www.nuget.org/packages/Serilog.Extensions.Logging) into your web or console app. You will need a way to view the log messages - _Serilog.Sinks.Literate_ writes these to the console.
### ASP.NET Core 1.0, 1.1, and Default Provider Integration

The package implements `AddSerilog()` on `ILoggingBuilder` and `ILoggerFactory` to enable the Serilog provider under the default _Microsoft.Extensions.Logging_ implementation.

**First**, install the _Serilog.Extensions.Logging_ [NuGet package](https://www.nuget.org/packages/Serilog.Extensions.Logging) into your web or console app. You will need a way to view the log messages - _Serilog.Sinks.Console_ writes these to the console.

```powershell
Install-Package Serilog.Extensions.Logging -DependencyVersion Highest
Expand All @@ -32,7 +36,7 @@ public class Startup
```

**Finally**, in your `Startup` class's `Configure()` method, remove the existing logger configuration entries and
call `AddSerilog()` on the provided `loggerFactory`.
call `AddSerilog()` on the provided `loggingBuilder`.

```csharp
public void ConfigureServices(IServiceCollection services)
Expand Down
36 changes: 0 additions & 36 deletions samples/SimpleWebSample/Controllers/ScopesController.cs

This file was deleted.

19 changes: 0 additions & 19 deletions samples/SimpleWebSample/Controllers/ValuesController.cs

This file was deleted.

53 changes: 0 additions & 53 deletions samples/SimpleWebSample/Program.cs

This file was deleted.

27 changes: 0 additions & 27 deletions samples/SimpleWebSample/Properties/launchSettings.json

This file was deleted.

20 changes: 0 additions & 20 deletions samples/SimpleWebSample/README.md

This file was deleted.

22 changes: 0 additions & 22 deletions samples/SimpleWebSample/SimpleWebSample.csproj

This file was deleted.

40 changes: 0 additions & 40 deletions samples/SimpleWebSample/Startup.cs

This file was deleted.

10 changes: 0 additions & 10 deletions samples/SimpleWebSample/appsettings.Development.json

This file was deleted.

11 changes: 0 additions & 11 deletions samples/SimpleWebSample/appsettings.json

This file was deleted.

7 changes: 0 additions & 7 deletions serilog-extensions-logging.sln
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{9C21B9
assets\Serilog.snk = assets\Serilog.snk
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleWebSample", "samples\SimpleWebSample\SimpleWebSample.csproj", "{69F9A0ED-7910-4F33-8919-28BB05376FBC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -44,10 +42,6 @@ Global
{65357FBC-9BC4-466D-B621-1C3A19BC2A78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{65357FBC-9BC4-466D-B621-1C3A19BC2A78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{65357FBC-9BC4-466D-B621-1C3A19BC2A78}.Release|Any CPU.Build.0 = Release|Any CPU
{69F9A0ED-7910-4F33-8919-28BB05376FBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{69F9A0ED-7910-4F33-8919-28BB05376FBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{69F9A0ED-7910-4F33-8919-28BB05376FBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{69F9A0ED-7910-4F33-8919-28BB05376FBC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -56,7 +50,6 @@ Global
{903CD13A-D54B-4CEC-A55F-E22AE3D93B3B} = {A1893BD1-333D-4DFE-A0F0-DDBB2FE526E0}
{37EADF84-5E41-4224-A194-1E3299DCD0B8} = {E30F638E-BBBE-4AD1-93CE-48CC69CFEFE1}
{65357FBC-9BC4-466D-B621-1C3A19BC2A78} = {F2407211-6043-439C-8E06-3641634332E7}
{69F9A0ED-7910-4F33-8919-28BB05376FBC} = {F2407211-6043-439C-8E06-3641634332E7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {811E61C5-3871-4633-AFAE-B35B619C8A10}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>Serilog provider for Microsoft.Extensions.Logging</Description>
<VersionPrefix>2.1.0</VersionPrefix>
<Description>Low-level Serilog provider for Microsoft.Extensions.Logging</Description>
<VersionPrefix>2.0.1</VersionPrefix>
<Authors>Microsoft;Serilog Contributors</Authors>
<TargetFrameworks>net45;net46;net461;netstandard1.3;netstandard2.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand All @@ -29,7 +29,6 @@
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' or '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
</ItemGroup>
Expand Down
Loading

0 comments on commit 8f8d105

Please sign in to comment.