Applying file-scoped namespaces

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
This commit is contained in:
Whit Waldo 2025-07-12 12:01:19 -05:00
parent fb1d30482e
commit fab821bd00
1 changed files with 45 additions and 45 deletions

View File

@ -11,61 +11,61 @@
// limitations under the License.
// ------------------------------------------------------------------------
namespace Dapr.Workflow
namespace Dapr.Workflow;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System.Collections.Concurrent;
/// <summary>
/// Defines runtime options for workflows.
/// </summary>
internal sealed class WorkflowLoggingService : IHostedService
{
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System.Collections.Concurrent;
private readonly ILogger<WorkflowLoggingService> logger;
private static readonly ConcurrentDictionary<string, byte> registeredWorkflows = new();
private static readonly ConcurrentDictionary<string, byte> registeredActivities = new();
/// <summary>
/// Defines runtime options for workflows.
/// </summary>
internal sealed class WorkflowLoggingService : IHostedService
public WorkflowLoggingService(ILogger<WorkflowLoggingService> logger)
{
private readonly ILogger<WorkflowLoggingService> logger;
private static readonly ConcurrentDictionary<string, byte> registeredWorkflows = new();
private static readonly ConcurrentDictionary<string, byte> registeredActivities = new();
this.logger = logger;
}
public Task StartAsync(CancellationToken cancellationToken)
{
this.logger.Log(LogLevel.Information, "WorkflowLoggingService started");
public WorkflowLoggingService(ILogger<WorkflowLoggingService> logger)
this.logger.Log(LogLevel.Information, "List of registered workflows");
foreach (string item in registeredWorkflows.Keys)
{
this.logger = logger;
}
public Task StartAsync(CancellationToken cancellationToken)
{
this.logger.Log(LogLevel.Information, "WorkflowLoggingService started");
this.logger.Log(LogLevel.Information, "List of registered workflows");
foreach (string item in registeredWorkflows.Keys)
{
this.logger.Log(LogLevel.Information, item);
}
this.logger.Log(LogLevel.Information, "List of registered activities:");
foreach (string item in registeredActivities.Keys)
{
this.logger.Log(LogLevel.Information, item);
}
return Task.CompletedTask;
this.logger.Log(LogLevel.Information, item);
}
public Task StopAsync(CancellationToken cancellationToken)
this.logger.Log(LogLevel.Information, "List of registered activities:");
foreach (string item in registeredActivities.Keys)
{
this.logger.Log(LogLevel.Information, "WorkflowLoggingService stopped");
return Task.CompletedTask;
this.logger.Log(LogLevel.Information, item);
}
public static void LogWorkflowName(string workflowName)
{
registeredWorkflows.TryAdd(workflowName, 0);
}
return Task.CompletedTask;
}
public static void LogActivityName(string activityName)
{
registeredActivities.TryAdd(activityName, 0);
}
public Task StopAsync(CancellationToken cancellationToken)
{
this.logger.Log(LogLevel.Information, "WorkflowLoggingService stopped");
return Task.CompletedTask;
}
public static void LogWorkflowName(string workflowName)
{
registeredWorkflows.TryAdd(workflowName, 0);
}
public static void LogActivityName(string activityName)
{
registeredActivities.TryAdd(activityName, 0);
}
}