mirror of https://github.com/dapr/dotnet-sdk.git
				
				
				
			Injecting via primary constructor
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
This commit is contained in:
		
							parent
							
								
									fab821bd00
								
							
						
					
					
						commit
						4579828ee1
					
				|  | @ -22,30 +22,25 @@ using System.Collections.Concurrent; | ||||||
| /// <summary> | /// <summary> | ||||||
| /// Defines runtime options for workflows. | /// Defines runtime options for workflows. | ||||||
| /// </summary> | /// </summary> | ||||||
| internal sealed class WorkflowLoggingService : IHostedService | internal sealed class WorkflowLoggingService(ILogger<WorkflowLoggingService> logger) : IHostedService | ||||||
| { | { | ||||||
|     private readonly ILogger<WorkflowLoggingService> logger; |  | ||||||
|     private static readonly ConcurrentDictionary<string, byte> registeredWorkflows = new(); |     private static readonly ConcurrentDictionary<string, byte> registeredWorkflows = new(); | ||||||
|     private static readonly ConcurrentDictionary<string, byte> registeredActivities = new(); |     private static readonly ConcurrentDictionary<string, byte> registeredActivities = new(); | ||||||
| 
 | 
 | ||||||
|     public WorkflowLoggingService(ILogger<WorkflowLoggingService> logger) |  | ||||||
|     { |  | ||||||
|         this.logger = logger; |  | ||||||
|     } |  | ||||||
|     public Task StartAsync(CancellationToken cancellationToken) |     public Task StartAsync(CancellationToken cancellationToken) | ||||||
|     { |     { | ||||||
|         this.logger.Log(LogLevel.Information, "WorkflowLoggingService started"); |         logger.Log(LogLevel.Information, "WorkflowLoggingService started"); | ||||||
| 
 | 
 | ||||||
|         this.logger.Log(LogLevel.Information, "List of registered workflows"); |         logger.Log(LogLevel.Information, "List of registered workflows"); | ||||||
|         foreach (string item in registeredWorkflows.Keys) |         foreach (string item in registeredWorkflows.Keys) | ||||||
|         { |         { | ||||||
|             this.logger.Log(LogLevel.Information, item); |             logger.Log(LogLevel.Information, item); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         this.logger.Log(LogLevel.Information, "List of registered activities:"); |         logger.Log(LogLevel.Information, "List of registered activities:"); | ||||||
|         foreach (string item in registeredActivities.Keys) |         foreach (string item in registeredActivities.Keys) | ||||||
|         { |         { | ||||||
|             this.logger.Log(LogLevel.Information, item); |             logger.Log(LogLevel.Information, item); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         return Task.CompletedTask; |         return Task.CompletedTask; | ||||||
|  | @ -53,7 +48,7 @@ internal sealed class WorkflowLoggingService : IHostedService | ||||||
| 
 | 
 | ||||||
|     public Task StopAsync(CancellationToken cancellationToken) |     public Task StopAsync(CancellationToken cancellationToken) | ||||||
|     { |     { | ||||||
|         this.logger.Log(LogLevel.Information, "WorkflowLoggingService stopped"); |         logger.Log(LogLevel.Information, "WorkflowLoggingService stopped"); | ||||||
| 
 | 
 | ||||||
|         return Task.CompletedTask; |         return Task.CompletedTask; | ||||||
|     } |     } | ||||||
|  | @ -67,5 +62,4 @@ internal sealed class WorkflowLoggingService : IHostedService | ||||||
|     { |     { | ||||||
|         registeredActivities.TryAdd(activityName, 0); |         registeredActivities.TryAdd(activityName, 0); | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue