Skip to content

Commit 6acc280

Browse files
committed
Use CreateStaticLogger for command loggers
1 parent 89ee38f commit 6acc280

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

src/ServiceControl.Audit/Infrastructure/Hosting/Commands/ImportFailedAuditsCommand.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
using Microsoft.Extensions.Hosting;
99
using Microsoft.Extensions.Logging;
1010
using NServiceBus;
11+
using ServiceControl.Infrastructure;
1112
using Settings;
1213

13-
class ImportFailedAuditsCommand(ILogger<ImportFailedAuditsCommand> logger) : AbstractCommand
14+
class ImportFailedAuditsCommand : AbstractCommand
1415
{
1516
public override async Task Execute(HostArguments args, Settings settings)
1617
{
@@ -40,7 +41,7 @@ public override async Task Execute(HostArguments args, Settings settings)
4041
}
4142
catch (OperationCanceledException e) when (tokenSource.IsCancellationRequested)
4243
{
43-
logger.LogInformation(e, "Cancelled");
44+
LoggerUtil.CreateStaticLogger<ImportFailedAuditsCommand>().LogInformation(e, "Cancelled");
4445
}
4546
finally
4647
{

src/ServiceControl.Audit/Infrastructure/Hosting/Commands/SetupCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
using Settings;
1010
using Transports;
1111

12-
class SetupCommand() : AbstractCommand
12+
class SetupCommand : AbstractCommand
1313
{
1414
public override async Task Execute(HostArguments args, Settings settings)
1515
{

src/ServiceControl/Hosting/Commands/ImportFailedErrorsCommand.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
using Particular.ServiceControl;
1313
using Particular.ServiceControl.Hosting;
1414
using ServiceBus.Management.Infrastructure.Settings;
15+
using ServiceControl.Infrastructure;
1516

16-
class ImportFailedErrorsCommand(ILogger<ImportFailedErrorsCommand> logger) : AbstractCommand
17+
class ImportFailedErrorsCommand : AbstractCommand
1718
{
1819
public override async Task Execute(HostArguments args, Settings settings)
1920
{
@@ -41,7 +42,7 @@ public override async Task Execute(HostArguments args, Settings settings)
4142
}
4243
catch (OperationCanceledException e) when (tokenSource.IsCancellationRequested)
4344
{
44-
logger.LogInformation(e, "Cancelled");
45+
LoggerUtil.CreateStaticLogger<ImportFailedErrorsCommand>().LogInformation(e, "Cancelled");
4546
}
4647
finally
4748
{

src/ServiceControl/Hosting/Commands/SetupCommand.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
using Particular.ServiceControl.Hosting;
99
using ServiceBus.Management.Infrastructure.Installers;
1010
using ServiceBus.Management.Infrastructure.Settings;
11+
using ServiceControl.Infrastructure;
1112
using Transports;
1213

13-
class SetupCommand(ILogger<SetupCommand> logger) : AbstractCommand
14+
class SetupCommand : AbstractCommand
1415
{
1516
public override async Task Execute(HostArguments args, Settings settings)
1617
{
@@ -35,7 +36,7 @@ public override async Task Execute(HostArguments args, Settings settings)
3536

3637
if (args.SkipQueueCreation)
3738
{
38-
logger.LogInformation("Skipping queue creation");
39+
LoggerUtil.CreateStaticLogger<SetupCommand>().LogInformation("Skipping queue creation");
3940
}
4041
else
4142
{

0 commit comments

Comments
 (0)