diff --git a/README.md b/README.md index 2c3e9e8..f4c2578 100644 --- a/README.md +++ b/README.md @@ -286,3 +286,7 @@ using (logger.PushProperty("OperationType", "update")) // UserId and OperationType are set for all logging events in these brackets } ``` + +### Versioning + +This package tracks the versioning and target framework support of its (indirect) [_Microsoft.Extensions.Hosting_](https://nuget.org/packages/Microsoft.Extensions.Hosting) dependency. diff --git a/global.json b/global.json index 99ee408..2c23bfe 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ { "sdk": { "allowPrerelease": false, - "version": "6.0.401", + "version": "7.0.100", "rollForward": "latestFeature" } } diff --git a/samples/Sample/Sample.csproj b/samples/Sample/Sample.csproj index f32c84b..99ca1cf 100644 --- a/samples/Sample/Sample.csproj +++ b/samples/Sample/Sample.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 diff --git a/src/Serilog.AspNetCore/Properties/AssemblyInfo.cs b/src/Serilog.AspNetCore/Properties/AssemblyInfo.cs index 9e85a56..b8042d5 100644 --- a/src/Serilog.AspNetCore/Properties/AssemblyInfo.cs +++ b/src/Serilog.AspNetCore/Properties/AssemblyInfo.cs @@ -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.AspNetCore.Tests, PublicKey=" + "0024000004800000940000000602000000240000525341310004000001000100fb8d13fd344a1c" + diff --git a/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj b/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj index 748fcae..605b1de 100644 --- a/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj +++ b/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj @@ -2,9 +2,10 @@ Serilog support for ASP.NET Core logging - 6.1.1 + + 7.0.0 Microsoft;Serilog Contributors - netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0 + net462;netstandard2.0;netstandard2.1;net6.0;net7.0 true serilog;aspnet;aspnetcore icon.png @@ -20,44 +21,30 @@ - - $(DefineConstants);HOSTBUILDER - - - - + - - - - - - - - - - - - - + + + + + + - + + - - - - - - - + + + + - + diff --git a/src/Serilog.AspNetCore/SerilogWebHostBuilderExtensions.cs b/src/Serilog.AspNetCore/SerilogWebHostBuilderExtensions.cs index a144808..c998f4f 100644 --- a/src/Serilog.AspNetCore/SerilogWebHostBuilderExtensions.cs +++ b/src/Serilog.AspNetCore/SerilogWebHostBuilderExtensions.cs @@ -37,9 +37,7 @@ public static class SerilogWebHostBuilderExtensions /// WriteTo.Providers() configuration method, enabling other s to receive events. By /// default, only Serilog sinks will receive events. /// The web host builder. -#if HOSTBUILDER - [Obsolete("Prefer UseSerilog() on IHostBuilder")] -#endif + [Obsolete("Prefer UseSerilog() on IHostBuilder")] public static IWebHostBuilder UseSerilog( this IWebHostBuilder builder, ILogger? logger = null, @@ -85,9 +83,7 @@ public static IWebHostBuilder UseSerilog( /// the Microsoft.Extensions.Logging API. Normally, equivalent Serilog sinks are used in place of providers. Specify /// true to write events to all providers. /// The web host builder. -#if HOSTBUILDER - [Obsolete("Prefer UseSerilog() on IHostBuilder")] -#endif + [Obsolete("Prefer UseSerilog() on IHostBuilder")] public static IWebHostBuilder UseSerilog( this IWebHostBuilder builder, Action configureLogger, diff --git a/test/Serilog.AspNetCore.Tests/Serilog.AspNetCore.Tests.csproj b/test/Serilog.AspNetCore.Tests/Serilog.AspNetCore.Tests.csproj index 240288c..0f65b57 100644 --- a/test/Serilog.AspNetCore.Tests/Serilog.AspNetCore.Tests.csproj +++ b/test/Serilog.AspNetCore.Tests/Serilog.AspNetCore.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;net6.0 + net7.0 true @@ -11,16 +11,9 @@ - - - - - - - - - - + + + diff --git a/test/Serilog.AspNetCore.Tests/Support/DisposeTrackingLogger.cs b/test/Serilog.AspNetCore.Tests/Support/DisposeTrackingLogger.cs index a441089..14278ef 100644 --- a/test/Serilog.AspNetCore.Tests/Support/DisposeTrackingLogger.cs +++ b/test/Serilog.AspNetCore.Tests/Support/DisposeTrackingLogger.cs @@ -1,11 +1,12 @@ -using Serilog.Core; +using System.Diagnostics.CodeAnalysis; +using Serilog.Core; using Serilog.Events; namespace Serilog.AspNetCore.Tests.Support; -public class DisposeTrackingLogger : ILogger, IDisposable +sealed class DisposeTrackingLogger : ILogger, IDisposable { - public bool IsDisposed { get; set; } + public bool IsDisposed { get; private set; } public ILogger ForContext(ILogEventEnricher enricher) { @@ -17,7 +18,7 @@ public ILogger ForContext(IEnumerable enrichers) return new LoggerConfiguration().CreateLogger(); } - public ILogger ForContext(string propertyName, object value, bool destructureObjects = false) + public ILogger ForContext(string propertyName, object? value, bool destructureObjects = false) { return new LoggerConfiguration().CreateLogger(); } @@ -53,29 +54,29 @@ public void Write(LogEventLevel level, string messageTemplate, T0 pr { } - public void Write(LogEventLevel level, string messageTemplate, params object[] propertyValues) + public void Write(LogEventLevel level, string messageTemplate, params object?[]? propertyValues) { } - public void Write(LogEventLevel level, Exception exception, string messageTemplate) + public void Write(LogEventLevel level, Exception? exception, string messageTemplate) { } - public void Write(LogEventLevel level, Exception exception, string messageTemplate, T propertyValue) + public void Write(LogEventLevel level, Exception? exception, string messageTemplate, T propertyValue) { } - public void Write(LogEventLevel level, Exception exception, string messageTemplate, T0 propertyValue0, + public void Write(LogEventLevel level, Exception? exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) { } - public void Write(LogEventLevel level, Exception exception, string messageTemplate, T0 propertyValue0, + public void Write(LogEventLevel level, Exception? exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) { } - public void Write(LogEventLevel level, Exception exception, string messageTemplate, params object[] propertyValues) + public void Write(LogEventLevel level, Exception? exception, string messageTemplate, params object?[]? propertyValues) { } @@ -100,28 +101,28 @@ public void Verbose(string messageTemplate, T0 propertyValue0, T1 pr { } - public void Verbose(string messageTemplate, params object[] propertyValues) + public void Verbose(string messageTemplate, params object?[]? propertyValues) { } - public void Verbose(Exception exception, string messageTemplate) + public void Verbose(Exception? exception, string messageTemplate) { } - public void Verbose(Exception exception, string messageTemplate, T propertyValue) + public void Verbose(Exception? exception, string messageTemplate, T propertyValue) { } - public void Verbose(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + public void Verbose(Exception? exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) { } - public void Verbose(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, + public void Verbose(Exception? exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) { } - public void Verbose(Exception exception, string messageTemplate, params object[] propertyValues) + public void Verbose(Exception? exception, string messageTemplate, params object?[]? propertyValues) { } @@ -141,28 +142,28 @@ public void Debug(string messageTemplate, T0 propertyValue0, T1 prop { } - public void Debug(string messageTemplate, params object[] propertyValues) + public void Debug(string messageTemplate, params object?[]? propertyValues) { } - public void Debug(Exception exception, string messageTemplate) + public void Debug(Exception? exception, string messageTemplate) { } - public void Debug(Exception exception, string messageTemplate, T propertyValue) + public void Debug(Exception? exception, string messageTemplate, T propertyValue) { } - public void Debug(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + public void Debug(Exception? exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) { } - public void Debug(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, + public void Debug(Exception? exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) { } - public void Debug(Exception exception, string messageTemplate, params object[] propertyValues) + public void Debug(Exception? exception, string messageTemplate, params object?[]? propertyValues) { } @@ -182,28 +183,28 @@ public void Information(string messageTemplate, T0 propertyValue0, T { } - public void Information(string messageTemplate, params object[] propertyValues) + public void Information(string messageTemplate, params object?[]? propertyValues) { } - public void Information(Exception exception, string messageTemplate) + public void Information(Exception? exception, string messageTemplate) { } - public void Information(Exception exception, string messageTemplate, T propertyValue) + public void Information(Exception? exception, string messageTemplate, T propertyValue) { } - public void Information(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + public void Information(Exception? exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) { } - public void Information(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, + public void Information(Exception? exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) { } - public void Information(Exception exception, string messageTemplate, params object[] propertyValues) + public void Information(Exception? exception, string messageTemplate, params object?[]? propertyValues) { } @@ -223,28 +224,28 @@ public void Warning(string messageTemplate, T0 propertyValue0, T1 pr { } - public void Warning(string messageTemplate, params object[] propertyValues) + public void Warning(string messageTemplate, params object?[]? propertyValues) { } - public void Warning(Exception exception, string messageTemplate) + public void Warning(Exception? exception, string messageTemplate) { } - public void Warning(Exception exception, string messageTemplate, T propertyValue) + public void Warning(Exception? exception, string messageTemplate, T propertyValue) { } - public void Warning(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + public void Warning(Exception? exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) { } - public void Warning(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, + public void Warning(Exception? exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) { } - public void Warning(Exception exception, string messageTemplate, params object[] propertyValues) + public void Warning(Exception? exception, string messageTemplate, params object?[]? propertyValues) { } @@ -264,28 +265,28 @@ public void Error(string messageTemplate, T0 propertyValue0, T1 prop { } - public void Error(string messageTemplate, params object[] propertyValues) + public void Error(string messageTemplate, params object?[]? propertyValues) { } - public void Error(Exception exception, string messageTemplate) + public void Error(Exception? exception, string messageTemplate) { } - public void Error(Exception exception, string messageTemplate, T propertyValue) + public void Error(Exception? exception, string messageTemplate, T propertyValue) { } - public void Error(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + public void Error(Exception? exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) { } - public void Error(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, + public void Error(Exception? exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) { } - public void Error(Exception exception, string messageTemplate, params object[] propertyValues) + public void Error(Exception? exception, string messageTemplate, params object?[]? propertyValues) { } @@ -305,43 +306,43 @@ public void Fatal(string messageTemplate, T0 propertyValue0, T1 prop { } - public void Fatal(string messageTemplate, params object[] propertyValues) + public void Fatal(string messageTemplate, params object?[]? propertyValues) { } - public void Fatal(Exception exception, string messageTemplate) + public void Fatal(Exception? exception, string messageTemplate) { } - public void Fatal(Exception exception, string messageTemplate, T propertyValue) + public void Fatal(Exception? exception, string messageTemplate, T propertyValue) { } - public void Fatal(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + public void Fatal(Exception? exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) { } - public void Fatal(Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, + public void Fatal(Exception? exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) { } - public void Fatal(Exception exception, string messageTemplate, params object[] propertyValues) + public void Fatal(Exception? exception, string messageTemplate, params object?[]? propertyValues) { } public bool BindMessageTemplate( string messageTemplate, - object[] propertyValues, - out MessageTemplate? parsedTemplate, - out IEnumerable? boundProperties) + object?[]? propertyValues, + [NotNullWhen(true)] out MessageTemplate? parsedTemplate, + [NotNullWhen(true)] out IEnumerable? boundProperties) { parsedTemplate = null; boundProperties = null; return false; } - public bool BindProperty(string propertyName, object value, bool destructureObjects, out LogEventProperty? property) + public bool BindProperty(string? propertyName, object? value, bool destructureObjects, [NotNullWhen(true)] out LogEventProperty? property) { property = null; return false; diff --git a/test/Serilog.AspNetCore.Tests/Support/Extensions.cs b/test/Serilog.AspNetCore.Tests/Support/Extensions.cs index 78ac692..822dd61 100644 --- a/test/Serilog.AspNetCore.Tests/Support/Extensions.cs +++ b/test/Serilog.AspNetCore.Tests/Support/Extensions.cs @@ -2,9 +2,9 @@ namespace Serilog.AspNetCore.Tests.Support; -public static class Extensions +static class Extensions { - public static object LiteralValue(this LogEventPropertyValue @this) + public static object? LiteralValue(this LogEventPropertyValue @this) { return ((ScalarValue)@this).Value; }