From 07286fca6f56c9d8bc119e241313e76813c6cbdf Mon Sep 17 00:00:00 2001 From: Gert Jansen van Rensburg Date: Sat, 15 Jul 2017 07:18:22 +1000 Subject: [PATCH 1/9] Ignore JetBrains Rider meta files. --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index bc52de5..e7d9000 100644 --- a/.gitignore +++ b/.gitignore @@ -129,7 +129,7 @@ publish/ # Publish Web Output *.[Pp]ublish.xml *.azurePubxml -# TODO: Comment the next line if you want to checkin your web deploy settings +# TODO: Comment the next line if you want to checkin your web deploy settings # but database connection strings (with potential passwords) will be unencrypted *.pubxml *.publishproj @@ -196,3 +196,6 @@ FakesAssemblies/ *.opt *.orig project.lock.json + +# JetBrains Rider +.idea From 3fa0fcdd80ee86a8e7de1f99df20b2b1af143bd8 Mon Sep 17 00:00:00 2001 From: Gert Jansen van Rensburg Date: Sat, 15 Jul 2017 07:19:20 +1000 Subject: [PATCH 2/9] Added new extension method to configure serilog from services. --- .../SerilogLoggerServicesExtensions.cs | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/Serilog.Extensions.Logging/SerilogLoggerServicesExtensions.cs diff --git a/src/Serilog.Extensions.Logging/SerilogLoggerServicesExtensions.cs b/src/Serilog.Extensions.Logging/SerilogLoggerServicesExtensions.cs new file mode 100644 index 0000000..524055d --- /dev/null +++ b/src/Serilog.Extensions.Logging/SerilogLoggerServicesExtensions.cs @@ -0,0 +1,45 @@ +using System; +using Microsoft.Extensions.Logging; +using Serilog.Extensions.Logging; +using System.ComponentModel; + +namespace Serilog +{ + /// + /// Extends with Serilog configuration methods. + /// + public static class SerilogLoggerServicesExtensions + { + /// + /// Add Serilog to the logging pipeline. + /// + /// The to add services to. + /// The Serilog logger; if not supplied, the static will be used. + /// The logger factory. + [EditorBrowsable(EditorBrowsableState.Never)] + public static IServiceCollection AddSerilog(this IServiceCollection services, ILogger logger) + { + if (services == null) throw new ArgumentNullException(nameof(services)); + + return services.AddSerilog(logger, false); + } + + /// + /// Add Serilog to the logging pipeline. + /// + /// The to add services to. + /// The Serilog logger; if not supplied, the static will be used. + /// When true, dispose when the framework disposes the provider. If the + /// logger is not specified but is true, the method will be + /// called on the static class instead. + /// The logger factory. + public static IServiceCollection AddSerilog(this IServiceCollection services, Serilog.ILogger logger = null, bool dispose = false) + { + if (services == null) throw new ArgumentNullException(nameof(services)); + + services.AddLogging(builder => builder.AddProvider(new SerilogLoggerProvider(logger, dispose))); + + return services; + } + } +} \ No newline at end of file From b484f37e6c9891406d9fdb23a383302901acb4ee Mon Sep 17 00:00:00 2001 From: Gert Jansen van Rensburg Date: Sat, 15 Jul 2017 07:22:58 +1000 Subject: [PATCH 3/9] Update csproj to target netstandard 2.0 --- .../Serilog.Extensions.Logging.csproj | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj index 2259620..325b48d 100644 --- a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj +++ b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj @@ -4,7 +4,7 @@ Serilog provider for Microsoft.Extensions.Logging 1.4.1 Microsoft;Serilog Contributors - net45;net46;netstandard1.3 + net45;net46;netstandard1.3,netstandard2.0 true true Serilog.Extensions.Logging @@ -22,7 +22,6 @@ - @@ -30,12 +29,25 @@ + + + + + + + + + + + + + @@ -46,4 +58,8 @@ $(DefineConstants);ASYNCLOCAL + + $(DefineConstants);ASYNCLOCAL + + From 62bfb8abfe27e21b58ef90c4c35d197bbf3fce06 Mon Sep 17 00:00:00 2001 From: Gert Jansen van Rensburg Date: Sat, 15 Jul 2017 07:28:20 +1000 Subject: [PATCH 4/9] update to dotnet cli 2.0.0-preview2-006497 --- appveyor.yml | 6 +++--- global.json | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 4409040..d2b3156 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,9 +4,9 @@ image: Visual Studio 2015 configuration: Release install: - ps: mkdir -Force ".\build\" | Out-Null - - ps: Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.ps1" -OutFile ".\build\installcli.ps1" + - ps: Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/release/2.0.0-preview2/scripts/obtain/dotnet-install.ps1" -OutFile ".\build\installcli.ps1" - ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetcli" - - ps: '& .\build\installcli.ps1 -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath -Version 1.0.3' + - ps: '& .\build\installcli.ps1 -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath -Version 2.0.0-preview2-006497' - ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path" build_script: - ps: ./Build.ps1 @@ -27,4 +27,4 @@ deploy: tag: v$(appveyor_build_version) on: branch: master - + diff --git a/global.json b/global.json index 2fc780b..73bdd84 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "1.0.3" + "version": "2.0.0-preview2-006497" } -} \ No newline at end of file +} From 1b940d709d91f5b6dcb5f1010096b5bc198b2e8b Mon Sep 17 00:00:00 2001 From: Gert Jansen van Rensburg Date: Sat, 15 Jul 2017 07:42:33 +1000 Subject: [PATCH 5/9] Single char errors :( --- .../Serilog.Extensions.Logging.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj index 325b48d..5411785 100644 --- a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj +++ b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj @@ -4,7 +4,7 @@ Serilog provider for Microsoft.Extensions.Logging 1.4.1 Microsoft;Serilog Contributors - net45;net46;netstandard1.3,netstandard2.0 + net45;net46;netstandard1.3;netstandard2.0 true true Serilog.Extensions.Logging From 129caf9fa3e8bb6042aabd1682c25efb44341ea2 Mon Sep 17 00:00:00 2001 From: Gert Jansen van Rensburg Date: Sat, 15 Jul 2017 07:57:16 +1000 Subject: [PATCH 6/9] Missing package references. --- .../Serilog.Extensions.Logging.csproj | 12 ++---------- .../SerilogLoggerServicesExtensions.cs | 1 + 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj index 5411785..676e711 100644 --- a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj +++ b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj @@ -1,5 +1,4 @@  - Serilog provider for Microsoft.Extensions.Logging 1.4.1 @@ -20,46 +19,39 @@ true - - - - - + + - $(DefineConstants);ASYNCLOCAL - $(DefineConstants);ASYNCLOCAL - $(DefineConstants);ASYNCLOCAL - diff --git a/src/Serilog.Extensions.Logging/SerilogLoggerServicesExtensions.cs b/src/Serilog.Extensions.Logging/SerilogLoggerServicesExtensions.cs index 524055d..6ec2f52 100644 --- a/src/Serilog.Extensions.Logging/SerilogLoggerServicesExtensions.cs +++ b/src/Serilog.Extensions.Logging/SerilogLoggerServicesExtensions.cs @@ -2,6 +2,7 @@ using Microsoft.Extensions.Logging; using Serilog.Extensions.Logging; using System.ComponentModel; +using Microsoft.Extensions.DependencyInjection; namespace Serilog { From 16999ccea24eb840a44835e06bfe3c10c0663a6c Mon Sep 17 00:00:00 2001 From: Gert Jansen van Rensburg Date: Sat, 15 Jul 2017 08:23:43 +1000 Subject: [PATCH 7/9] Not sure why Microsoft.Extensions.DependencyInjection isn't picked up. --- .../Serilog.Extensions.Logging.csproj | 10 ++++++++++ .../SerilogLoggerServicesExtensions.cs | 9 +++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj index 676e711..35e161d 100644 --- a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj +++ b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj @@ -1,4 +1,5 @@  + Serilog provider for Microsoft.Extensions.Logging 1.4.1 @@ -19,25 +20,30 @@ true + + + + + @@ -45,13 +51,17 @@ + $(DefineConstants);ASYNCLOCAL + $(DefineConstants);ASYNCLOCAL + $(DefineConstants);ASYNCLOCAL + diff --git a/src/Serilog.Extensions.Logging/SerilogLoggerServicesExtensions.cs b/src/Serilog.Extensions.Logging/SerilogLoggerServicesExtensions.cs index 6ec2f52..2e5c11a 100644 --- a/src/Serilog.Extensions.Logging/SerilogLoggerServicesExtensions.cs +++ b/src/Serilog.Extensions.Logging/SerilogLoggerServicesExtensions.cs @@ -1,8 +1,9 @@ using System; -using Microsoft.Extensions.Logging; -using Serilog.Extensions.Logging; using System.ComponentModel; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Serilog.Extensions.Logging; + namespace Serilog { @@ -10,7 +11,7 @@ namespace Serilog /// Extends with Serilog configuration methods. /// public static class SerilogLoggerServicesExtensions - { + { /// /// Add Serilog to the logging pipeline. /// @@ -43,4 +44,4 @@ public static IServiceCollection AddSerilog(this IServiceCollection services, Se return services; } } -} \ No newline at end of file +} From 3f866024af44e1d4efb447b15b1fb7317cc320f3 Mon Sep 17 00:00:00 2001 From: Gert Jansen van Rensburg Date: Sat, 15 Jul 2017 10:54:03 +1000 Subject: [PATCH 8/9] Think I figured out what is wrong. --- .../Serilog.Extensions.Logging.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj index 35e161d..ed390ee 100644 --- a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj +++ b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj @@ -30,6 +30,7 @@ + @@ -37,6 +38,7 @@ + From 882b8215077f61c88328913b58923f6769edb748 Mon Sep 17 00:00:00 2001 From: Gert Jansen van Rensburg Date: Mon, 17 Jul 2017 11:08:52 +1000 Subject: [PATCH 9/9] Removed unneeded extension and updated the version prefix as requested. --- .../Serilog.Extensions.Logging.csproj | 2 +- .../SerilogLoggerServicesExtensions.cs | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj index ed390ee..9741108 100644 --- a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj +++ b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj @@ -2,7 +2,7 @@ Serilog provider for Microsoft.Extensions.Logging - 1.4.1 + 2.0.0 Microsoft;Serilog Contributors net45;net46;netstandard1.3;netstandard2.0 true diff --git a/src/Serilog.Extensions.Logging/SerilogLoggerServicesExtensions.cs b/src/Serilog.Extensions.Logging/SerilogLoggerServicesExtensions.cs index 2e5c11a..fb98981 100644 --- a/src/Serilog.Extensions.Logging/SerilogLoggerServicesExtensions.cs +++ b/src/Serilog.Extensions.Logging/SerilogLoggerServicesExtensions.cs @@ -12,20 +12,6 @@ namespace Serilog /// public static class SerilogLoggerServicesExtensions { - /// - /// Add Serilog to the logging pipeline. - /// - /// The to add services to. - /// The Serilog logger; if not supplied, the static will be used. - /// The logger factory. - [EditorBrowsable(EditorBrowsableState.Never)] - public static IServiceCollection AddSerilog(this IServiceCollection services, ILogger logger) - { - if (services == null) throw new ArgumentNullException(nameof(services)); - - return services.AddSerilog(logger, false); - } - /// /// Add Serilog to the logging pipeline. ///