Skip to content

Commit

Permalink
(Non-building) v7; waiting for Serilog.Extensions.Logging v7-dev-*.
Browse files Browse the repository at this point in the history
  • Loading branch information
nblumhardt committed May 3, 2023
1 parent d19517a commit b02f94f
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 32 deletions.
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"allowPrerelease": false,
"version": "6.0.300",
"version": "7.0.100",
"rollForward": "latestFeature"
}
}
6 changes: 3 additions & 3 deletions samples/SimpleServiceSample/SimpleServiceSample.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Serilog.Extensions.Hosting\Serilog.Extensions.Hosting.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.4" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion samples/WebApplicationSample/WebApplicationSample.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
7 changes: 7 additions & 0 deletions serilog-extensions-hosting.sln
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleServiceSample", "samp
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebApplicationSample", "samples\WebApplicationSample\WebApplicationSample.csproj", "{1ACDCA67-F404-45AB-9348-98E55E03CB8C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Extensions.Logging", "..\serilog-extensions-logging\src\Serilog.Extensions.Logging\Serilog.Extensions.Logging.csproj", "{4369EFC6-EE7F-4CA1-B8C7-123C39B88708}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -48,6 +50,10 @@ Global
{1ACDCA67-F404-45AB-9348-98E55E03CB8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1ACDCA67-F404-45AB-9348-98E55E03CB8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1ACDCA67-F404-45AB-9348-98E55E03CB8C}.Release|Any CPU.Build.0 = Release|Any CPU
{4369EFC6-EE7F-4CA1-B8C7-123C39B88708}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4369EFC6-EE7F-4CA1-B8C7-123C39B88708}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4369EFC6-EE7F-4CA1-B8C7-123C39B88708}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4369EFC6-EE7F-4CA1-B8C7-123C39B88708}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -57,6 +63,7 @@ Global
{AD51759B-CD58-473F-9620-0B0E56A123A1} = {E30F638E-BBBE-4AD1-93CE-48CC69CFEFE1}
{E5A82756-4619-4E6B-8B26-6D83E00E99F0} = {F2407211-6043-439C-8E06-3641634332E7}
{1ACDCA67-F404-45AB-9348-98E55E03CB8C} = {F2407211-6043-439C-8E06-3641634332E7}
{4369EFC6-EE7F-4CA1-B8C7-123C39B88708} = {A1893BD1-333D-4DFE-A0F0-DDBB2FE526E0}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {811E61C5-3871-4633-AFAE-B35B619C8A10}
Expand Down
2 changes: 1 addition & 1 deletion src/Serilog.Extensions.Hosting/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;

[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyVersion("7.0.0.0")]

[assembly: InternalsVisibleTo("Serilog.Extensions.Hosting.Tests, PublicKey=" +
"0024000004800000940000000602000000240000525341310004000001000100fb8d13fd344a1c" +
Expand Down
26 changes: 14 additions & 12 deletions src/Serilog.Extensions.Hosting/Serilog.Extensions.Hosting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

<PropertyGroup>
<Description>Serilog support for .NET Core logging in hosted services</Description>
<VersionPrefix>5.1.0</VersionPrefix>
<!-- This must match the major and minor components of the referenced Microsoft.Extensions.Logging package. -->
<VersionPrefix>7.0.0</VersionPrefix>
<Authors>Microsoft;Serilog Contributors</Authors>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<!-- These must match the Dependencies tab in https://www.nuget.org/packages/microsoft.extensions.hosting at
the target version. -->
<TargetFrameworks>net462;netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<LangVersion>8</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>Serilog.Extensions.Hosting</AssemblyName>
<AssemblyOriginatorKeyFile>../../assets/Serilog.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageId>Serilog.Extensions.Hosting</PackageId>
<PackageTags>serilog;aspnet;aspnetcore;hosting</PackageTags>
<PackageIcon>icon.png</PackageIcon>
<PackageProjectUrl>https://github.com/serilog/serilog-extensions-hosting</PackageProjectUrl>
Expand All @@ -23,20 +24,21 @@
<RootNamespace>Serilog</RootNamespace>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'netstandard2.0' ">
<DefineConstants>$(DefineConstants);NO_RELOADABLE_LOGGER</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.1.8" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.8" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.8" />
<None Include="..\..\assets\icon.png" Pack="true" Visible="false" PackagePath="" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Serilog" Version="2.12.0" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\assets\icon.png" Pack="true" Visible="false" PackagePath="" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<!-- The versions of all references in this group must match the major and minor components of the package version prefix. -->
<ProjectReference Include="../../../serilog-extensions-logging/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
</ItemGroup>
</Project>
10 changes: 6 additions & 4 deletions test/Serilog.Extensions.Hosting.Tests/DiagnosticContextTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ public async Task PropertiesAreCollectedInAnActiveContext()
await Task.Delay(TimeSpan.FromMilliseconds(10));
dc.Set(Some.String("second"), Some.Int32());

Assert.True(collector.TryComplete(out var properties));
Assert.True(collector.TryComplete(out var properties, out var exception));
Assert.Equal(2, properties.Count());
Assert.Null(exception);

Assert.False(collector.TryComplete(out _));
Assert.False(collector.TryComplete(out _, out _));

collector.Dispose();

dc.Set(Some.String("third"), Some.Int32());
Assert.False(collector.TryComplete(out _));
Assert.False(collector.TryComplete(out _, out _));
}

[Fact]
Expand Down Expand Up @@ -97,10 +98,11 @@ public void ExistingPropertiesCanBeUpdated()
dc.Set("name", 10);
dc.Set("name", 20);

Assert.True(collector.TryComplete(out var properties));
Assert.True(collector.TryComplete(out var properties, out var exception));
var prop = Assert.Single(properties);
var scalar = Assert.IsType<ScalarValue>(prop.Value);
Assert.Equal(20, scalar.Value);
Assert.Null(exception);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net6.0;net4.8</TargetFrameworks>
<AssemblyName>Serilog.Extensions.Hosting.Tests</AssemblyName>
<TargetFrameworks>net6.0;net7.0;net4.8</TargetFrameworks>
<AssemblyOriginatorKeyFile>../../assets/Serilog.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<LangVersion>latest</LangVersion>
</PropertyGroup>

Expand All @@ -19,13 +17,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" PrivateAssets="all" />
<PackageReference Include="xunit" Version="2.4.2" />
</ItemGroup>

</Project>

0 comments on commit b02f94f

Please sign in to comment.