Skip to content

Commit

Permalink
Remove benchmark and CLI tests projects
Browse files Browse the repository at this point in the history
The projects Frank.PulseFlow.Tests.Benchmarks and Frank.PulseFlow.Tests.Cli have been removed as they were unnecessary. Some minor refactoring has been done to the logging feature, including added support for logging scopes.
  • Loading branch information
frankhaugen committed Dec 31, 2023
1 parent b43f6d3 commit 1898b60
Show file tree
Hide file tree
Showing 20 changed files with 21 additions and 218 deletions.
18 changes: 5 additions & 13 deletions Frank.PulseFlow.Logging/LogPulse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,12 @@

namespace Frank.PulseFlow.Logging;

public abstract class LogPulse : BasePulse
public class LogPulse<TState> : BasePulse
{
public abstract LogLevel LogLevel { get; }
public abstract EventId EventId { get; }
public abstract Exception? Exception { get; }
public abstract string CategoryName { get; }
}
public class LogPulse<TState> : LogPulse
{
public override LogLevel LogLevel { get; }
public override EventId EventId { get; }
public override Exception? Exception { get; }
public override string CategoryName { get; }

public LogLevel LogLevel { get; }
public EventId EventId { get; }
public Exception? Exception { get; }
public string CategoryName { get; }
public TState State { get; }
public Func<TState, Exception?, string> Formatter { get; }

Expand Down
6 changes: 1 addition & 5 deletions Frank.PulseFlow.Logging/PulseFlowLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,5 @@ public bool IsEnabled(LogLevel logLevel)
return logLevel >= filterOptions.MinLevel;
}

public IDisposable? BeginScope<TState>(TState state) where TState : notnull
{
// no scope support
return null;
}
public IDisposable? BeginScope<TState>(TState state) where TState : notnull => new PulseFlowLoggerScope<TState>(state);
}
10 changes: 10 additions & 0 deletions Frank.PulseFlow.Logging/PulseFlowLoggerScope.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Frank.PulseFlow.Logging;

public class PulseFlowLoggerScope<TState> : IDisposable
{
public TState? State { get; private set; }

public PulseFlowLoggerScope(TState state) => State = state;

public void Dispose() => State = default;
}
6 changes: 5 additions & 1 deletion Frank.PulseFlow.Logging/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

namespace Frank.PulseFlow.Logging;

public static class LoggingBuilderExtensions
{
/// <summary>
/// Adds PulseFlow logger provider to the logging builder.
/// </summary>
/// <param name="builder">The logging builder.</param>
/// <returns>The updated logging builder.</returns>
public static ILoggingBuilder AddPulseFlow(this ILoggingBuilder builder)
{
builder.Services.AddSingleton<ILoggerProvider, PulseFlowLoggerProvider>();
Expand Down
21 changes: 0 additions & 21 deletions Frank.PulseFlow.Tests.Benchmarks/Benchmarks.cs

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions Frank.PulseFlow.Tests.Benchmarks/Program.cs

This file was deleted.

6 changes: 0 additions & 6 deletions Frank.PulseFlow.Tests.Benchmarks/Shared/PersistenceService.cs

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions Frank.PulseFlow.Tests.Cli/Frank.PulseFlow.Tests.Cli.csproj

This file was deleted.

7 changes: 0 additions & 7 deletions Frank.PulseFlow.Tests.Cli/NotificationPulse.cs

This file was deleted.

17 changes: 0 additions & 17 deletions Frank.PulseFlow.Tests.Cli/Program.cs

This file was deleted.

12 changes: 0 additions & 12 deletions Frank.PulseFlow.Tests.Cli/Properties/launchSettings.json

This file was deleted.

18 changes: 0 additions & 18 deletions Frank.PulseFlow.Tests.Cli/TestingService.cs

This file was deleted.

17 changes: 0 additions & 17 deletions Frank.PulseFlow.Tests.Cli/TextFlow.cs

This file was deleted.

6 changes: 0 additions & 6 deletions Frank.PulseFlow.Tests.Cli/TextPulse.cs

This file was deleted.

8 changes: 0 additions & 8 deletions Frank.PulseFlow.Tests.Cli/appsettings.Development.json

This file was deleted.

8 changes: 0 additions & 8 deletions Frank.PulseFlow.Tests.Cli/appsettings.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ private IHostBuilder CreateHostBuilder()
services.AddPulseFlow(builder =>
{
builder.AddFlow<TestOutputFlow>();
// builder.AddFlow<Flow2>();
});

services.AddHostedService<MyService>();
Expand Down
12 changes: 0 additions & 12 deletions Frank.PulseFlow.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Frank.PulseFlow", "Frank.Pu
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Frank.PulseFlow.Tests", "Frank.PulseFlow.Tests\Frank.PulseFlow.Tests.csproj", "{CDFBB79A-4D36-4C6C-865A-EC6A48EEA08E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Frank.PulseFlow.Tests.Benchmarks", "Frank.PulseFlow.Tests.Benchmarks\Frank.PulseFlow.Tests.Benchmarks.csproj", "{31BB9094-E736-45DC-9310-386921878506}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Frank.PulseFlow.Tests.Cli", "Frank.PulseFlow.Tests.Cli\Frank.PulseFlow.Tests.Cli.csproj", "{A2981338-9563-49BD-BE39-EDFD759C39D7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F0BA9824-F862-4CCF-A326-7E5AB567F9E4}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
Expand Down Expand Up @@ -43,14 +39,6 @@ Global
{CDFBB79A-4D36-4C6C-865A-EC6A48EEA08E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CDFBB79A-4D36-4C6C-865A-EC6A48EEA08E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CDFBB79A-4D36-4C6C-865A-EC6A48EEA08E}.Release|Any CPU.Build.0 = Release|Any CPU
{31BB9094-E736-45DC-9310-386921878506}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{31BB9094-E736-45DC-9310-386921878506}.Debug|Any CPU.Build.0 = Debug|Any CPU
{31BB9094-E736-45DC-9310-386921878506}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31BB9094-E736-45DC-9310-386921878506}.Release|Any CPU.Build.0 = Release|Any CPU
{A2981338-9563-49BD-BE39-EDFD759C39D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A2981338-9563-49BD-BE39-EDFD759C39D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A2981338-9563-49BD-BE39-EDFD759C39D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A2981338-9563-49BD-BE39-EDFD759C39D7}.Release|Any CPU.Build.0 = Release|Any CPU
{37DF9EE8-CDF2-430C-B407-D9546088D890}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{37DF9EE8-CDF2-430C-B407-D9546088D890}.Debug|Any CPU.Build.0 = Debug|Any CPU
{37DF9EE8-CDF2-430C-B407-D9546088D890}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down

0 comments on commit 1898b60

Please sign in to comment.