diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 75d9788..516a924 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,7 @@ on: [push, pull_request] jobs: build: name: Build - runs-on: ubuntu-latest + runs-on: windows-latest steps: - name: Check out the repository uses: actions/checkout@v2 diff --git a/Build.ps1 b/Build.ps1 index 99ee2ff..c61d48d 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -20,19 +20,19 @@ $suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch echo "build: Version suffix is $suffix" -echo "build: Testing" & dotnet test -c Release "./test/$projectName.Tests/$projectName.Tests.csproj" -if ($LASTEXITCODE -ne 0) { exit 3 } +if ($LASTEXITCODE -ne 0) { throw "dotnet test failed" } -echo "build: Publishing and packing" $src = "./src/$projectName" + +& dotnet build -c Release --version-suffix=$suffix "$src/$projectName.csproj" +if ($LASTEXITCODE -ne 0) { throw "dotnet build failed" } + if ($suffix) { - & dotnet publish -c Release -o "$src/obj/publish" --version-suffix=$suffix "$src/$projectName.csproj" & dotnet pack -c Release -o ./artifacts --no-build --version-suffix=$suffix "$src/$projectName.csproj" } else { - & dotnet publish -c Release -o "$src/obj/publish" "$src/$projectName.csproj" & dotnet pack -c Release -o ./artifacts --no-build "$src/$projectName.csproj" } -if ($LASTEXITCODE -ne 0) { exit 1 } +if ($LASTEXITCODE -ne 0) { throw "dotnet pack failed" } Pop-Location diff --git a/global.json b/global.json deleted file mode 100644 index bd52dc5..0000000 --- a/global.json +++ /dev/null @@ -1 +0,0 @@ -{"projects":["src"]} \ No newline at end of file diff --git a/serilog-sinks-applicationinsights.sln b/serilog-sinks-applicationinsights.sln index ef8921a..527e542 100644 --- a/serilog-sinks-applicationinsights.sln +++ b/serilog-sinks-applicationinsights.sln @@ -5,14 +5,15 @@ VisualStudioVersion = 15.0.26621.2 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{037440DE-440B-4129-9F7A-09B42D00397E}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{E9D1B5E1-DEB9-4A04-8BAB-24EC7240ADAF}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "files", "files", "{E9D1B5E1-DEB9-4A04-8BAB-24EC7240ADAF}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig - appveyor.yml = appveyor.yml Build.ps1 = Build.ps1 - assets\CommonAssemblyInfo.cs = assets\CommonAssemblyInfo.cs README.md = README.md - assets\Serilog.snk = assets\Serilog.snk + .gitattributes = .gitattributes + .gitignore = .gitignore + CHANGES.md = CHANGES.md + LICENSE = LICENSE EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serilog.Sinks.ApplicationInsights", "src\Serilog.Sinks.ApplicationInsights\Serilog.Sinks.ApplicationInsights.csproj", "{B572E129-3568-435F-A8E9-366AD7014D8E}" diff --git a/src/Serilog.Sinks.ApplicationInsights/LoggerConfigurationApplicationInsightsExtensions.cs b/src/Serilog.Sinks.ApplicationInsights/LoggerConfigurationApplicationInsightsExtensions.cs index 5f697be..0fc9ec1 100644 --- a/src/Serilog.Sinks.ApplicationInsights/LoggerConfigurationApplicationInsightsExtensions.cs +++ b/src/Serilog.Sinks.ApplicationInsights/LoggerConfigurationApplicationInsightsExtensions.cs @@ -18,7 +18,7 @@ using Serilog.Configuration; using Serilog.Events; using Serilog.Sinks.ApplicationInsights; -using Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.TelemetryConverters; +using Serilog.Sinks.ApplicationInsights.TelemetryConverters; namespace Serilog { diff --git a/src/Serilog.Sinks.ApplicationInsights/Serilog.Sinks.ApplicationInsights.csproj b/src/Serilog.Sinks.ApplicationInsights/Serilog.Sinks.ApplicationInsights.csproj index ca76bf5..532cf5d 100644 --- a/src/Serilog.Sinks.ApplicationInsights/Serilog.Sinks.ApplicationInsights.csproj +++ b/src/Serilog.Sinks.ApplicationInsights/Serilog.Sinks.ApplicationInsights.csproj @@ -2,9 +2,9 @@ Serilog sink for Application Insights. - 3.1.1 + 4.0.0 Joerg Battermann, Ivan Gavryliuk, contributors - net452;net46;netstandard2.0;net6.0 + net4.6.2;netstandard2.0;net6.0 Serilog.Sinks.ApplicationInsights ../../assets/Serilog.snk true @@ -17,10 +17,7 @@ https://github.com/serilog-contrib/serilog-sinks-applicationinsights git true - - - - + Serilog @@ -28,11 +25,6 @@ - - - - - diff --git a/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/ApplicationInsightsSink.cs b/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/ApplicationInsightsSink.cs index 98ca990..cdb21f6 100644 --- a/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/ApplicationInsightsSink.cs +++ b/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/ApplicationInsightsSink.cs @@ -21,7 +21,7 @@ using Microsoft.ApplicationInsights.Channel; using Serilog.Core; using Serilog.Events; -using Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.TelemetryConverters; +using Serilog.Sinks.ApplicationInsights.TelemetryConverters; namespace Serilog.Sinks.ApplicationInsights { diff --git a/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/Formatters/ApplicationInsightsDottedValueFormatter.cs b/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/Formatters/ApplicationInsightsDottedValueFormatter.cs index 3f76d45..ce4742b 100644 --- a/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/Formatters/ApplicationInsightsDottedValueFormatter.cs +++ b/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/Formatters/ApplicationInsightsDottedValueFormatter.cs @@ -4,7 +4,7 @@ using Serilog.Debugging; using Serilog.Events; -namespace Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.Formatters +namespace Serilog.Sinks.ApplicationInsights.Formatters { public class ApplicationInsightsDottedValueFormatter : IValueFormatter { diff --git a/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/Formatters/ApplicationInsightsJsonValueFormatter.cs b/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/Formatters/ApplicationInsightsJsonValueFormatter.cs index d40f290..f308e17 100644 --- a/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/Formatters/ApplicationInsightsJsonValueFormatter.cs +++ b/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/Formatters/ApplicationInsightsJsonValueFormatter.cs @@ -4,7 +4,7 @@ using Serilog.Events; using Serilog.Formatting.Json; -namespace Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.Formatters +namespace Serilog.Sinks.ApplicationInsights.Formatters { public class ApplicationInsightsJsonValueFormatter : IValueFormatter { diff --git a/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/Formatters/IValueFormatter.cs b/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/Formatters/IValueFormatter.cs index 15dd701..c8745d6 100644 --- a/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/Formatters/IValueFormatter.cs +++ b/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/Formatters/IValueFormatter.cs @@ -1,7 +1,7 @@ -using Serilog.Events; -using System.Collections.Generic; +using System.Collections.Generic; +using Serilog.Events; -namespace Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.Formatters +namespace Serilog.Sinks.ApplicationInsights.Formatters { public interface IValueFormatter { diff --git a/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/TelemetryConverters/EventTelemetryConverter.cs b/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/TelemetryConverters/EventTelemetryConverter.cs index 1bd3103..e530ff9 100644 --- a/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/TelemetryConverters/EventTelemetryConverter.cs +++ b/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/TelemetryConverters/EventTelemetryConverter.cs @@ -4,7 +4,7 @@ using Microsoft.ApplicationInsights.DataContracts; using Serilog.Events; -namespace Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.TelemetryConverters +namespace Serilog.Sinks.ApplicationInsights.TelemetryConverters { public class EventTelemetryConverter : TelemetryConverterBase { diff --git a/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/TelemetryConverters/ITelemetryConverter.cs b/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/TelemetryConverters/ITelemetryConverter.cs index f041657..0d4b940 100644 --- a/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/TelemetryConverters/ITelemetryConverter.cs +++ b/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/TelemetryConverters/ITelemetryConverter.cs @@ -1,12 +1,9 @@ -using Microsoft.ApplicationInsights.Channel; -using Serilog.Events; -using System; +using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using Microsoft.ApplicationInsights.Channel; +using Serilog.Events; -namespace Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.TelemetryConverters +namespace Serilog.Sinks.ApplicationInsights.TelemetryConverters { public interface ITelemetryConverter { diff --git a/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/TelemetryConverters/TelemetryConverterBase.cs b/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/TelemetryConverters/TelemetryConverterBase.cs index 2635576..3784afd 100644 --- a/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/TelemetryConverters/TelemetryConverterBase.cs +++ b/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/TelemetryConverters/TelemetryConverterBase.cs @@ -4,9 +4,9 @@ using Microsoft.ApplicationInsights.Channel; using Microsoft.ApplicationInsights.DataContracts; using Serilog.Events; -using Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.Formatters; +using Serilog.Sinks.ApplicationInsights.Formatters; -namespace Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.TelemetryConverters +namespace Serilog.Sinks.ApplicationInsights.TelemetryConverters { /// /// Base class for telemetry converters diff --git a/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/TelemetryConverters/TraceTelemetryConverter.cs b/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/TelemetryConverters/TraceTelemetryConverter.cs index cb74f6e..36ccc92 100644 --- a/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/TelemetryConverters/TraceTelemetryConverter.cs +++ b/src/Serilog.Sinks.ApplicationInsights/Sinks/ApplicationInsights/TelemetryConverters/TraceTelemetryConverter.cs @@ -4,7 +4,7 @@ using Microsoft.ApplicationInsights.DataContracts; using Serilog.Events; -namespace Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.TelemetryConverters +namespace Serilog.Sinks.ApplicationInsights.TelemetryConverters { public class TraceTelemetryConverter : TelemetryConverterBase { diff --git a/src/Serilog.Sinks.ApplicationInsights/TelemetryConverter.cs b/src/Serilog.Sinks.ApplicationInsights/TelemetryConverter.cs index 95e4e11..88c0eec 100644 --- a/src/Serilog.Sinks.ApplicationInsights/TelemetryConverter.cs +++ b/src/Serilog.Sinks.ApplicationInsights/TelemetryConverter.cs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.TelemetryConverters; +using Serilog.Sinks.ApplicationInsights.TelemetryConverters; namespace Serilog { diff --git a/test/Serilog.Sinks.ApplicationInsights.Tests/ApplicationInsightsTest.cs b/test/Serilog.Sinks.ApplicationInsights.Tests/ApplicationInsightsTest.cs index 9118af4..e45e631 100644 --- a/test/Serilog.Sinks.ApplicationInsights.Tests/ApplicationInsightsTest.cs +++ b/test/Serilog.Sinks.ApplicationInsights.Tests/ApplicationInsightsTest.cs @@ -1,13 +1,9 @@ -using Microsoft.ApplicationInsights; -using Microsoft.ApplicationInsights.Channel; +using Microsoft.ApplicationInsights.Channel; using Microsoft.ApplicationInsights.DataContracts; using Microsoft.ApplicationInsights.Extensibility; -using Serilog.Events; -using Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.TelemetryConverters; -using System; using System.Collections.Generic; using System.Linq; -using System.Text; +using Serilog.Sinks.ApplicationInsights.TelemetryConverters; namespace Serilog.Sinks.ApplicationInsights.Tests { @@ -34,8 +30,7 @@ protected ApplicationInsightsTest(ITelemetryConverter converter = null) protected TraceTelemetry LastSubmittedTraceTelemetry => _channel.SubmittedTelemetry - .Where(t => t is TraceTelemetry) - .Select(t => (TraceTelemetry)t) + .OfType() .LastOrDefault(); } diff --git a/test/Serilog.Sinks.ApplicationInsights.Tests/CustomTelemetryConversionTest.cs b/test/Serilog.Sinks.ApplicationInsights.Tests/CustomTelemetryConversionTest.cs index 2f1a09f..2c2c06b 100644 --- a/test/Serilog.Sinks.ApplicationInsights.Tests/CustomTelemetryConversionTest.cs +++ b/test/Serilog.Sinks.ApplicationInsights.Tests/CustomTelemetryConversionTest.cs @@ -1,10 +1,10 @@ using Microsoft.ApplicationInsights.Channel; using Microsoft.ApplicationInsights.DataContracts; using Serilog.Events; -using Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.TelemetryConverters; using System; using System.Collections.Generic; using System.Linq; +using Serilog.Sinks.ApplicationInsights.TelemetryConverters; using Xunit; namespace Serilog.Sinks.ApplicationInsights.Tests diff --git a/test/Serilog.Sinks.ApplicationInsights.Tests/CustomiseEventTelemetryConverterTest.cs b/test/Serilog.Sinks.ApplicationInsights.Tests/CustomiseEventTelemetryConverterTest.cs index 6dbb4df..a1625f3 100644 --- a/test/Serilog.Sinks.ApplicationInsights.Tests/CustomiseEventTelemetryConverterTest.cs +++ b/test/Serilog.Sinks.ApplicationInsights.Tests/CustomiseEventTelemetryConverterTest.cs @@ -1,9 +1,7 @@ using System; -using System.Collections.Generic; -using System.Text; using Microsoft.ApplicationInsights.DataContracts; using Serilog.Events; -using Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.TelemetryConverters; +using Serilog.Sinks.ApplicationInsights.TelemetryConverters; namespace Serilog.Sinks.ApplicationInsights.Tests { diff --git a/test/Serilog.Sinks.ApplicationInsights.Tests/DottedOutFormattingTest.cs b/test/Serilog.Sinks.ApplicationInsights.Tests/DottedOutFormattingTest.cs index 17a4aca..2e7596a 100644 --- a/test/Serilog.Sinks.ApplicationInsights.Tests/DottedOutFormattingTest.cs +++ b/test/Serilog.Sinks.ApplicationInsights.Tests/DottedOutFormattingTest.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.Formatters; -using Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.TelemetryConverters; +using Serilog.Sinks.ApplicationInsights.Formatters; +using Serilog.Sinks.ApplicationInsights.TelemetryConverters; using Xunit; namespace Serilog.Sinks.ApplicationInsights.Tests diff --git a/test/Serilog.Sinks.ApplicationInsights.Tests/Serilog.Sinks.ApplicationInsights.Tests.csproj b/test/Serilog.Sinks.ApplicationInsights.Tests/Serilog.Sinks.ApplicationInsights.Tests.csproj index 50c1578..e03b2f8 100644 --- a/test/Serilog.Sinks.ApplicationInsights.Tests/Serilog.Sinks.ApplicationInsights.Tests.csproj +++ b/test/Serilog.Sinks.ApplicationInsights.Tests/Serilog.Sinks.ApplicationInsights.Tests.csproj @@ -1,7 +1,7 @@ - net5.0;netcoreapp3.1;netcoreapp2.1 + net6.0;net4.8 false diff --git a/test/Serilog.Sinks.ApplicationInsights.Tests/TelemetryConversionTest.cs b/test/Serilog.Sinks.ApplicationInsights.Tests/TelemetryConversionTest.cs index 0a79a13..9f035ee 100644 --- a/test/Serilog.Sinks.ApplicationInsights.Tests/TelemetryConversionTest.cs +++ b/test/Serilog.Sinks.ApplicationInsights.Tests/TelemetryConversionTest.cs @@ -1,10 +1,10 @@ using Microsoft.ApplicationInsights.Channel; using Microsoft.ApplicationInsights.DataContracts; using Serilog.Events; -using Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.TelemetryConverters; using System; using System.Collections.Generic; using System.Linq; +using Serilog.Sinks.ApplicationInsights.TelemetryConverters; using Xunit; namespace Serilog.Sinks.ApplicationInsights.Tests