From bb94090c13f164da2946d223f4a2c89beaeaa7b2 Mon Sep 17 00:00:00 2001 From: Daniel Destouche Date: Mon, 23 May 2022 19:17:00 -0400 Subject: [PATCH 01/13] Pre-release & pipeline preparation --- .github/workflows/dotnet-package.yml | 28 +++++++++++++++++++ DIrectory.Build.props | 6 ++++ README.md | 28 +++++++++++++++++-- ...eyondTech.Extensions.Logging.Timing.csproj | 26 ++++++++++++++++- .../README.md | 2 +- .../OperationTests.cs | 2 ++ test/TestApp/Program.cs | 3 +- 7 files changed, 88 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/dotnet-package.yml create mode 100644 DIrectory.Build.props diff --git a/.github/workflows/dotnet-package.yml b/.github/workflows/dotnet-package.yml new file mode 100644 index 0000000..4ce3459 --- /dev/null +++ b/.github/workflows/dotnet-package.yml @@ -0,0 +1,28 @@ +name: package + +on: + release: + types: [created] + +jobs: + deploy: + + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-dotnet@v2 + with: + dotnet-version: '6.0.x' + - run: dotnet build --configuration Release . + - name: Create the package + run: dotnet pack --configuration Release . + - name: Publish the package to nuget.org + run: | + dotnet nuget push src/BeyondTech.Extensions.Logging.Timing/bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json + dotnet nuget push src/BeyondTech.Extensions.Logging.Timing/bin/Release/*.snupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json + env: + NUGET_AUTH_TOKEN: ${{secrets.NUGET_TOKEN}} \ No newline at end of file diff --git a/DIrectory.Build.props b/DIrectory.Build.props new file mode 100644 index 0000000..6e49852 --- /dev/null +++ b/DIrectory.Build.props @@ -0,0 +1,6 @@ + + + net6.0;netstandard2.1;netstandard2.0 + 1.0.0-pre.1 + + \ No newline at end of file diff --git a/README.md b/README.md index 4ab3eea..f93bb21 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,31 @@ # BeyondTech Logging Extensions -### Timing [![Coverage Status](https://coveralls.io/repos/github/ghost1face/beyondtech-extensions-logging/badge.svg?branch=master)](https://coveralls.io/github/ghost1face/beyondtech-extensions-logging?branch=master) +Extensions for Microsoft's `ILogger` for common use cases. -Timing extensions for logging [here](./src/BeyondTech.Extensions.Logging.Timing/README.md) +## BeyondTech.Extensions.Logging.Timing +[![.NET Actions Status](https://github.com/ghost1face/beyondtech-extensions-logging/workflows/.NET/badge.svg?branch=master)](https://github.com/ghost1face/beyondtech-extensions-logging/actions) [![Coverage Status](https://coveralls.io/repos/github/ghost1face/beyondtech-extensions-logging/badge.svg?branch=master)](https://coveralls.io/github/ghost1face/beyondtech-extensions-logging?branch=master) +[![Nuget](https://img.shields.io/nuget/v/BeyondTech.Extensions.Logging.Timing.svg)](https://www.nuget.org/packages/BeyondTech.Extensions.Logging.Timing) + + +Timing extensions for logging operations: [here](./src/BeyondTech.Extensions.Logging.Timing/README.md) + +This lets you perfom simple logging for timed operations, while simplifying the boilerplate: + +```cs +ILogger logger = // assign instance + +using (var operation = logger.BeginOperation("Processing large file {FilePath}", filePath)) +{ + operation.Complete(); +} +``` + +Yields: + +``` +info: Processing large file /d/test/image.png completed in 822.5 ms +``` ### License -See the [license](LICENSE.md) \ No newline at end of file +Licensed under [Apache 2.0](LICENSE.md) \ No newline at end of file diff --git a/src/BeyondTech.Extensions.Logging.Timing/BeyondTech.Extensions.Logging.Timing.csproj b/src/BeyondTech.Extensions.Logging.Timing/BeyondTech.Extensions.Logging.Timing.csproj index 2026ed3..f0b86ba 100644 --- a/src/BeyondTech.Extensions.Logging.Timing/BeyondTech.Extensions.Logging.Timing.csproj +++ b/src/BeyondTech.Extensions.Logging.Timing/BeyondTech.Extensions.Logging.Timing.csproj @@ -1,14 +1,38 @@  - net6.0;netstandard2.1;netstandard2.0 + $(TargetFrameworks) + $(Version) true enable 10 + true + + ghost1face + 2022 + https://github.com/ghost1face/beyondtech-extensions-logging + https://github.com/ghost1face/beyondtech-extensions-logging + git + csharp;logging;ilogger;extensions;timing;metrics;operations; + Apache-2.0 + true + true + true + snupkg + Initial release + + + + true + true + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + diff --git a/src/BeyondTech.Extensions.Logging.Timing/README.md b/src/BeyondTech.Extensions.Logging.Timing/README.md index bb3f399..df7dba0 100644 --- a/src/BeyondTech.Extensions.Logging.Timing/README.md +++ b/src/BeyondTech.Extensions.Logging.Timing/README.md @@ -1,4 +1,4 @@ -# Timing Extensions [![Coverage Status](https://coveralls.io/repos/github/ghost1face/beyondtech-extensions-logging/badge.svg?branch=master)](https://coveralls.io/github/ghost1face/beyondtech-extensions-logging?branch=master) +# Timing Extensions This library is a direct port of @nblumhardt 's [Serilog Timing](https://github.com/nblumhardt/serilog-timings) for usage directly with Microsoft's `ILogger`. This library provides ***almost*** all the same benefits of the Serilog Timing, but expands the support for any implementation of `ILogger`. diff --git a/test/BeyondTech.Extensions.Logging.Timing.Tests/OperationTests.cs b/test/BeyondTech.Extensions.Logging.Timing.Tests/OperationTests.cs index df2ac95..e15fae9 100644 --- a/test/BeyondTech.Extensions.Logging.Timing.Tests/OperationTests.cs +++ b/test/BeyondTech.Extensions.Logging.Timing.Tests/OperationTests.cs @@ -247,9 +247,11 @@ public void Operation_SetExceptionAndRethrow_Throws() public void Operation_ThrowsWhenILoggerIsNull() { ILogger? logger = null; +#pragma warning disable CS8604 // Possible null reference argument. Assert.Throws(() => logger.OperationAt(LogLevel.Information)); Assert.Throws(() => logger.BeginOperation("")); Assert.Throws(() => logger.TimeOperation("")); +#pragma warning restore CS8604 // Possible null reference argument. } } } \ No newline at end of file diff --git a/test/TestApp/Program.cs b/test/TestApp/Program.cs index fd92781..f04da3b 100644 --- a/test/TestApp/Program.cs +++ b/test/TestApp/Program.cs @@ -1,4 +1,3 @@ -using System; using BeyondTech.Extensions.Logging.Timing; using Microsoft.Extensions.Logging; @@ -26,7 +25,7 @@ return 0; } -catch (Exception ex) +catch { return -1; } From a664d65b794fd5865ff53a7bd8a359c6f1ae17c5 Mon Sep 17 00:00:00 2001 From: Daniel Destouche Date: Mon, 23 May 2022 22:54:44 -0400 Subject: [PATCH 02/13] Fix target frameworks --- .../BeyondTech.Extensions.Logging.Timing.Tests.csproj | 2 +- .../OperationTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/BeyondTech.Extensions.Logging.Timing.Tests/BeyondTech.Extensions.Logging.Timing.Tests.csproj b/test/BeyondTech.Extensions.Logging.Timing.Tests/BeyondTech.Extensions.Logging.Timing.Tests.csproj index 5d86a8a..3006ab4 100644 --- a/test/BeyondTech.Extensions.Logging.Timing.Tests/BeyondTech.Extensions.Logging.Timing.Tests.csproj +++ b/test/BeyondTech.Extensions.Logging.Timing.Tests/BeyondTech.Extensions.Logging.Timing.Tests.csproj @@ -1,7 +1,7 @@ - net6.0 + net6.0 enable false diff --git a/test/BeyondTech.Extensions.Logging.Timing.Tests/OperationTests.cs b/test/BeyondTech.Extensions.Logging.Timing.Tests/OperationTests.cs index e15fae9..6f3dc97 100644 --- a/test/BeyondTech.Extensions.Logging.Timing.Tests/OperationTests.cs +++ b/test/BeyondTech.Extensions.Logging.Timing.Tests/OperationTests.cs @@ -221,7 +221,7 @@ public void Operation_LogsExceptionWhenSet() public void Operation_SetExceptionAndRethrow_Throws() { var logs = new List(); - + Assert.Throws(() => { using (var logger = new TailLogger(logs)) From 2070636fe7003a54cf9f330c54f3cdb867357f2d Mon Sep 17 00:00:00 2001 From: Daniel Destouche Date: Mon, 23 May 2022 23:01:29 -0400 Subject: [PATCH 03/13] Fix casing --- DIrectory.Build.props => Directory.Build.props | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename DIrectory.Build.props => Directory.Build.props (100%) diff --git a/DIrectory.Build.props b/Directory.Build.props similarity index 100% rename from DIrectory.Build.props rename to Directory.Build.props From a64690077d1c3924d363fea653fe57b1adc72723 Mon Sep 17 00:00:00 2001 From: Daniel Destouche Date: Mon, 23 May 2022 23:34:00 -0400 Subject: [PATCH 04/13] Remove unnecessary step --- .github/workflows/dotnet-package.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/dotnet-package.yml b/.github/workflows/dotnet-package.yml index 4ce3459..73f4ace 100644 --- a/.github/workflows/dotnet-package.yml +++ b/.github/workflows/dotnet-package.yml @@ -18,8 +18,6 @@ jobs: with: dotnet-version: '6.0.x' - run: dotnet build --configuration Release . - - name: Create the package - run: dotnet pack --configuration Release . - name: Publish the package to nuget.org run: | dotnet nuget push src/BeyondTech.Extensions.Logging.Timing/bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json From ce4c251de9bc28b7630ab33fabda39ec0f14b37e Mon Sep 17 00:00:00 2001 From: Daniel Destouche Date: Mon, 23 May 2022 23:43:52 -0400 Subject: [PATCH 05/13] Remove duplicate command --- .github/workflows/dotnet-package.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/dotnet-package.yml b/.github/workflows/dotnet-package.yml index 73f4ace..1cb4b04 100644 --- a/.github/workflows/dotnet-package.yml +++ b/.github/workflows/dotnet-package.yml @@ -19,8 +19,6 @@ jobs: dotnet-version: '6.0.x' - run: dotnet build --configuration Release . - name: Publish the package to nuget.org - run: | - dotnet nuget push src/BeyondTech.Extensions.Logging.Timing/bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json - dotnet nuget push src/BeyondTech.Extensions.Logging.Timing/bin/Release/*.snupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json + run: dotnet nuget push src/BeyondTech.Extensions.Logging.Timing/bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json --skip-duplicate env: NUGET_AUTH_TOKEN: ${{secrets.NUGET_TOKEN}} \ No newline at end of file From 040c87a5b2d2a055eb473dd75b2d8eb0c17f206a Mon Sep 17 00:00:00 2001 From: Daniel Destouche Date: Sun, 30 Oct 2022 01:24:44 -0400 Subject: [PATCH 06/13] cleanup --- .github/workflows/dotnet-package.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dotnet-package.yml b/.github/workflows/dotnet-package.yml index 1cb4b04..46ed2db 100644 --- a/.github/workflows/dotnet-package.yml +++ b/.github/workflows/dotnet-package.yml @@ -6,7 +6,6 @@ on: jobs: deploy: - runs-on: ubuntu-latest permissions: packages: write @@ -16,9 +15,9 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-dotnet@v2 with: - dotnet-version: '6.0.x' + dotnet-version: 6.0.x - run: dotnet build --configuration Release . - name: Publish the package to nuget.org run: dotnet nuget push src/BeyondTech.Extensions.Logging.Timing/bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json --skip-duplicate env: - NUGET_AUTH_TOKEN: ${{secrets.NUGET_TOKEN}} \ No newline at end of file + NUGET_AUTH_TOKEN: ${{secrets.NUGET_TOKEN}} From 06f94898ef29d0653cca8eb0f355474f7de2c60d Mon Sep 17 00:00:00 2001 From: Daniel Destouche Date: Sun, 30 Oct 2022 13:04:59 -0400 Subject: [PATCH 07/13] code coverage in pipeline --- .github/workflows/dotnet.yml | 4 ++-- .gitignore | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index eabc730..7222f43 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -22,9 +22,9 @@ jobs: - name: Build run: dotnet build --no-restore - name: Test - run: dotnet test --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutput=coverage /p:CoverletOutputFormat=lcov + run: dotnet test --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutput=coverage /p:CoverletOutputFormat=lcov /p:Threshold=80 /p:ThresholdType=line /p:ThresholdStat=average - name: Publish coverage report uses: coverallsapp/github-action@master with: github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: ./test/BeyondTech.Extensions.Logging.Timing.Tests/coverage.info + path-to-lcov: ./test/BeyondTech.Extensions.Logging.Timing.Tests/coverage.net6.0.info diff --git a/.gitignore b/.gitignore index 8382d33..7acffbf 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ **/[Ll]og/ **/.vs/ **/.vscode/ -*.csproj.user \ No newline at end of file +*.csproj.user +coverage.*.info \ No newline at end of file From 737e95fa1243d5f59be41b472b3cc34ddc8dd743 Mon Sep 17 00:00:00 2001 From: Daniel Destouche Date: Sun, 30 Oct 2022 20:56:16 -0400 Subject: [PATCH 08/13] More coverage --- .../OperationTests.cs | 53 ++++++++++++++++++- test/TestApp/Program.cs | 13 +++-- test/TestApp/TestApp.csproj | 1 + 3 files changed, 61 insertions(+), 6 deletions(-) diff --git a/test/BeyondTech.Extensions.Logging.Timing.Tests/OperationTests.cs b/test/BeyondTech.Extensions.Logging.Timing.Tests/OperationTests.cs index 6f3dc97..c08a45c 100644 --- a/test/BeyondTech.Extensions.Logging.Timing.Tests/OperationTests.cs +++ b/test/BeyondTech.Extensions.Logging.Timing.Tests/OperationTests.cs @@ -3,6 +3,7 @@ using System.Threading; using BeyondTech.Extensions.Logging.Timing.Tests.Utilities; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; using Xunit; namespace BeyondTech.Extensions.Logging.Timing.Tests @@ -200,6 +201,38 @@ public void OperationAt_LogsNothingIfLogLevelIsNotSpecified() Assert.Empty(logs); } + [Fact] + public void Operation_ThrowsWhenCompleteIsCalledWithANullTemplate() + { + const string operationName = "Long Op!"; + + var logger = NullLogger.Instance; + using (var operation = logger.BeginOperation(operationName)) + { +#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type. + Assert.Throws(() => operation.Complete(null)); +#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type. + } + } + + [Fact] + public void Operation_LogsMessageOnComplete() + { + var logs = new List(); + + const string operationName = "Long Op!"; + + using (var logger = new TailLogger(logs)) + using (var operation = logger.Logger.OperationAt(LogLevel.Debug, LogLevel.Critical, TimeSpan.FromMilliseconds(1)).Begin(operationName)) + { + operation.Complete("This is complete!"); + } + + Assert.Single(logs); + Assert.StartsWith("dbug:", logs[0]); + Assert.Contains("This is complete", logs[0]); + } + [Fact] public void Operation_LogsExceptionWhenSet() { @@ -221,7 +254,7 @@ public void Operation_LogsExceptionWhenSet() public void Operation_SetExceptionAndRethrow_Throws() { var logs = new List(); - + Assert.Throws(() => { using (var logger = new TailLogger(logs)) @@ -251,6 +284,24 @@ public void Operation_ThrowsWhenILoggerIsNull() Assert.Throws(() => logger.OperationAt(LogLevel.Information)); Assert.Throws(() => logger.BeginOperation("")); Assert.Throws(() => logger.TimeOperation("")); +#pragma warning restore CS8604 // Possible null reference argument. + } + + [Fact] + public void Operation_ThrowsWhenMessageTemplateIsNull() + { +#pragma warning disable CS8604 // Possible null reference argument. + string? messageTemplate = null; + Assert.Throws(() => NullLogger.Instance.BeginOperation(messageTemplate)); +#pragma warning restore CS8604 // Possible null reference argument. + } + + [Fact] + public void Operation_ThrowsWhenArgsAreNull() + { +#pragma warning disable CS8604 // Possible null reference argument. + object[]? args = null; + Assert.Throws(() => NullLogger.Instance.BeginOperation("This is a template", args)); #pragma warning restore CS8604 // Possible null reference argument. } } diff --git a/test/TestApp/Program.cs b/test/TestApp/Program.cs index f04da3b..ed918b0 100644 --- a/test/TestApp/Program.cs +++ b/test/TestApp/Program.cs @@ -15,12 +15,15 @@ try { - logger.LogInformation("Hello, world!"); - - using (var op = logger.BeginOperation("Processing data {Data}", 123)) + using (logger.TimeOperation("Full operation")) { - await System.Threading.Tasks.Task.Delay(400); - op.Complete("Data processed with status code: {StatusCode}", 200); + logger.LogInformation("Hello, world!"); + + using (var op = logger.BeginOperation("Processing data {Data}", 123)) + { + await System.Threading.Tasks.Task.Delay(400); + op.Complete("Data processed with status code: {StatusCode}", 200); + } } return 0; diff --git a/test/TestApp/TestApp.csproj b/test/TestApp/TestApp.csproj index 6e3d609..543dafe 100644 --- a/test/TestApp/TestApp.csproj +++ b/test/TestApp/TestApp.csproj @@ -4,6 +4,7 @@ net6.0 Exe enable + latest From a914a8fe0fad31174dfcb1622f48ff283a2dddbd Mon Sep 17 00:00:00 2001 From: Daniel Destouche Date: Mon, 31 Oct 2022 20:42:32 -0400 Subject: [PATCH 09/13] Use double to improve stopwatch resolution --- src/BeyondTech.Extensions.Logging.Timing/Operation.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BeyondTech.Extensions.Logging.Timing/Operation.cs b/src/BeyondTech.Extensions.Logging.Timing/Operation.cs index 47082d5..60f6ef7 100644 --- a/src/BeyondTech.Extensions.Logging.Timing/Operation.cs +++ b/src/BeyondTech.Extensions.Logging.Timing/Operation.cs @@ -34,7 +34,7 @@ enum Properties private const string OutcomeCompleted = "completed"; private const string OutcomeAbandoned = "abandoned"; - private static readonly long StopwatchToTimeSpanTicks = Stopwatch.Frequency / TimeSpan.TicksPerSecond; + private static readonly double StopwatchToTimeSpanTicks = (double)Stopwatch.Frequency / TimeSpan.TicksPerSecond; private readonly ILogger _logger; private readonly string _messageTemplate; @@ -67,7 +67,7 @@ internal Operation(ILogger logger, string messageTemplate, object[] args, private static long GetTimestamp() { - return Stopwatch.GetTimestamp() / StopwatchToTimeSpanTicks; + return unchecked((long)(Stopwatch.GetTimestamp() / StopwatchToTimeSpanTicks)); } /// From 97aa8023f55d6b30961625196a1bb0e0e6911fee Mon Sep 17 00:00:00 2001 From: Daniel Destouche Date: Mon, 31 Oct 2022 20:48:34 -0400 Subject: [PATCH 10/13] Update project file missing elements --- .../BeyondTech.Extensions.Logging.Timing.csproj | 13 +++++++++++++ ...eyondTech.Extensions.Logging.Timing.Tests.csproj | 8 ++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/BeyondTech.Extensions.Logging.Timing/BeyondTech.Extensions.Logging.Timing.csproj b/src/BeyondTech.Extensions.Logging.Timing/BeyondTech.Extensions.Logging.Timing.csproj index f0b86ba..347a723 100644 --- a/src/BeyondTech.Extensions.Logging.Timing/BeyondTech.Extensions.Logging.Timing.csproj +++ b/src/BeyondTech.Extensions.Logging.Timing/BeyondTech.Extensions.Logging.Timing.csproj @@ -10,6 +10,7 @@ ghost1face 2022 + Extends ILogger for support for timed operations https://github.com/ghost1face/beyondtech-extensions-logging https://github.com/ghost1face/beyondtech-extensions-logging git @@ -19,6 +20,7 @@ true true snupkg + README.md Initial release @@ -28,6 +30,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + runtime; build; native; contentfiles; analyzers; buildtransitive @@ -35,4 +41,11 @@ + + + True + + + + diff --git a/test/BeyondTech.Extensions.Logging.Timing.Tests/BeyondTech.Extensions.Logging.Timing.Tests.csproj b/test/BeyondTech.Extensions.Logging.Timing.Tests/BeyondTech.Extensions.Logging.Timing.Tests.csproj index 3006ab4..7b7c7b3 100644 --- a/test/BeyondTech.Extensions.Logging.Timing.Tests/BeyondTech.Extensions.Logging.Timing.Tests.csproj +++ b/test/BeyondTech.Extensions.Logging.Timing.Tests/BeyondTech.Extensions.Logging.Timing.Tests.csproj @@ -8,6 +8,10 @@ + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -20,10 +24,6 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - From cc7b3470a2a678a4479cd501b5f24d34fa020fd5 Mon Sep 17 00:00:00 2001 From: Daniel Destouche Date: Mon, 31 Oct 2022 20:48:45 -0400 Subject: [PATCH 11/13] Add files to solution --- beyondtech-extensions-logging.sln | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/beyondtech-extensions-logging.sln b/beyondtech-extensions-logging.sln index 31dacae..0883d36 100644 --- a/beyondtech-extensions-logging.sln +++ b/beyondtech-extensions-logging.sln @@ -13,6 +13,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BeyondTech.Extensions.Loggi EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp", "test\TestApp\TestApp.csproj", "{4D9054AD-3C3A-4795-AD5E-1361F0D215FE}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0A2A68B3-F3E5-4654-92CE-064E2015AD78}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + .gitattributes = .gitattributes + .gitignore = .gitignore + Directory.Build.props = Directory.Build.props + LICENSE.md = LICENSE.md + README.md = README.md + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU From 2504e154d8072809d3ac5fa2ec3146b377101f03 Mon Sep 17 00:00:00 2001 From: Daniel Destouche Date: Tue, 1 Nov 2022 21:14:24 -0400 Subject: [PATCH 12/13] Update pipeline --- .github/workflows/dotnet-package.yml | 5 +++-- Directory.Build.props | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dotnet-package.yml b/.github/workflows/dotnet-package.yml index 46ed2db..4f57f3b 100644 --- a/.github/workflows/dotnet-package.yml +++ b/.github/workflows/dotnet-package.yml @@ -2,7 +2,7 @@ name: package on: release: - types: [created] + types: [published] jobs: deploy: @@ -13,7 +13,8 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-dotnet@v2 + - name: Setup .NET + uses: actions/setup-dotnet@v3 with: dotnet-version: 6.0.x - run: dotnet build --configuration Release . diff --git a/Directory.Build.props b/Directory.Build.props index 6e49852..f871928 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ net6.0;netstandard2.1;netstandard2.0 - 1.0.0-pre.1 + 1.0.0 \ No newline at end of file From 83e1ad102d30fcd7e428280b8d809736619a4fbf Mon Sep 17 00:00:00 2001 From: Daniel Destouche Date: Tue, 1 Nov 2022 21:20:09 -0400 Subject: [PATCH 13/13] fix timing bug in test --- .../OperationTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/BeyondTech.Extensions.Logging.Timing.Tests/OperationTests.cs b/test/BeyondTech.Extensions.Logging.Timing.Tests/OperationTests.cs index c08a45c..32908f8 100644 --- a/test/BeyondTech.Extensions.Logging.Timing.Tests/OperationTests.cs +++ b/test/BeyondTech.Extensions.Logging.Timing.Tests/OperationTests.cs @@ -159,7 +159,7 @@ public void OperationAt_LogsSpecifiedLevelWhenAbandoned() const string operationName = "Long Op!"; using (var logger = new TailLogger(logs)) - using (var operation = logger.Logger.OperationAt(LogLevel.Debug, LogLevel.Critical, TimeSpan.FromMilliseconds(1)).Begin(operationName)) + using (var operation = logger.Logger.OperationAt(LogLevel.Debug, LogLevel.Critical, TimeSpan.FromMilliseconds(1000)).Begin(operationName)) { operation.Abandon(); } @@ -176,7 +176,7 @@ public void OperationAt_LogsSpecifiedLevelWhenComplete() const string operationName = "Long Op!"; using (var logger = new TailLogger(logs)) - using (var operation = logger.Logger.OperationAt(LogLevel.Debug, LogLevel.Critical, TimeSpan.FromMilliseconds(1)).Begin(operationName)) + using (var operation = logger.Logger.OperationAt(LogLevel.Debug, LogLevel.Critical, TimeSpan.FromMilliseconds(1000)).Begin(operationName)) { operation.Complete(); } @@ -193,7 +193,7 @@ public void OperationAt_LogsNothingIfLogLevelIsNotSpecified() const string operationName = "Long Op!"; using (var logger = new TailLogger(logs, LogLevel.Critical)) - using (var operation = logger.Logger.OperationAt(LogLevel.Debug, LogLevel.Debug, TimeSpan.FromMilliseconds(1)).Begin(operationName)) + using (var operation = logger.Logger.OperationAt(LogLevel.Debug, LogLevel.Debug, TimeSpan.FromMilliseconds(1000)).Begin(operationName)) { operation.Complete(); } @@ -223,7 +223,7 @@ public void Operation_LogsMessageOnComplete() const string operationName = "Long Op!"; using (var logger = new TailLogger(logs)) - using (var operation = logger.Logger.OperationAt(LogLevel.Debug, LogLevel.Critical, TimeSpan.FromMilliseconds(1)).Begin(operationName)) + using (var operation = logger.Logger.OperationAt(LogLevel.Debug, LogLevel.Critical, TimeSpan.FromMilliseconds(1000)).Begin(operationName)) { operation.Complete("This is complete!"); }