diff --git a/Serilog.Sinks.MSBuild/MSBuildSink.cs b/Serilog.Sinks.MSBuild/MSBuildSink.cs index b454e66..f170fdc 100644 --- a/Serilog.Sinks.MSBuild/MSBuildSink.cs +++ b/Serilog.Sinks.MSBuild/MSBuildSink.cs @@ -76,7 +76,7 @@ public class MSBuildSink : ILogEventSink public MSBuildSink(ITask task, IFormatProvider formatProvider = null) { _formatProvider = formatProvider; - _loggingHelper = new TaskLoggingHelper(task); + _loggingHelper = task is Task taskConcrete ? taskConcrete.Log : new TaskLoggingHelper(task); } /// diff --git a/Serilog.Sinks.MSBuild/Serilog.Sinks.MSBuild.csproj b/Serilog.Sinks.MSBuild/Serilog.Sinks.MSBuild.csproj index 5eef50f..f685685 100644 --- a/Serilog.Sinks.MSBuild/Serilog.Sinks.MSBuild.csproj +++ b/Serilog.Sinks.MSBuild/Serilog.Sinks.MSBuild.csproj @@ -1,7 +1,7 @@  - 1.1.0 + 1.1.1 net45;netstandard2.0 Serilog sink for MSBuild Theodore Tsirpanis @@ -12,7 +12,7 @@ It is useful when an MSBuild task calls code that uses Serilog. https://serilog.net/images/serilog-sink-nuget.png https://github.com/teo-tsirpanis/serilog-sinks-msbuild - Add deeper integration with MSBuild. + Avoid creating a TaskLoggingHelper if not needed. true true true