Skip to content

Commit 8b99fde

Browse files
committed
adds LoggingEnricher and updates IoC and tests
Integrates `LoggingEnricher` for enhanced logging configuration and ensures its proper registration in IoC. Updates tests and code generation to support this change.
1 parent 33174aa commit 8b99fde

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

new-cli/GitVersion.Cli.Generator.Tests/GitVersion.Cli.Generator.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<ItemGroup>
3131
<ProjectReference Include="..\GitVersion.Cli.Generator\GitVersion.Cli.Generator.csproj" />
3232
<ProjectReference Include="..\GitVersion.Common.Command\GitVersion.Common.Command.csproj" />
33+
<ProjectReference Include="..\GitVersion.Core\GitVersion.Core.csproj" />
3334
</ItemGroup>
3435

3536
</Project>

new-cli/GitVersion.Cli.Generator.Tests/SystemCommandlineGeneratorTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ public class CommandsModule : IGitVersionModule
107107
{
108108
public void RegisterTypes(IServiceCollection services)
109109
{
110-
services.AddSingleton<RootCommandImpl>();
111110
services.AddSingleton<ICliApp, CliAppImpl>();
111+
services.AddSingleton<RootCommandImpl>();
112112
113113
services.AddSingleton<TestCommand>();
114114
services.AddSingleton<ICommandImpl, TestCommandImpl>();
@@ -188,7 +188,7 @@ public Task<int> RunAsync(string[] args, CancellationToken cancellationToken)
188188
var logFile = parseResult.GetValue<FileInfo?>(GitVersionSettings.LogFileOption);
189189
var verbosity = parseResult.GetValue<Verbosity?>(GitVersionSettings.VerbosityOption) ?? Verbosity.Normal;
190190
191-
// LoggingEnricher.Configure(logFile?.FullName, verbosity);
191+
LoggingEnricher.Configure(logFile?.FullName, verbosity);
192192
193193
return parseResult.InvokeAsync(cancellationToken: cancellationToken);
194194
}
@@ -259,6 +259,7 @@ public async Task ValidateGeneratedCommandImplementation()
259259
MetadataReference.CreateFromFile(typeof(RootCommand).Assembly.Location),
260260
MetadataReference.CreateFromFile(typeof(CommandAttribute).Assembly.Location),
261261
MetadataReference.CreateFromFile(typeof(IGitVersionModule).Assembly.Location),
262+
MetadataReference.CreateFromFile(typeof(LoggingEnricher).Assembly.Location),
262263
}
263264
}
264265
};

new-cli/GitVersion.Cli.Generator/SystemCommandlineContent.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,10 @@ public class CommandsModule : IGitVersionModule
111111
{
112112
public void RegisterTypes(IServiceCollection services)
113113
{
114-
{{- $commands = Model | array.sort "CommandTypeName" }}
115-
services.AddSingleton<RootCommandImpl>();
116114
services.AddSingleton<ICliApp, CliAppImpl>();
115+
services.AddSingleton<RootCommandImpl>();
116+
117+
{{- $commands = Model | array.sort "CommandTypeName" }}
117118
118119
{{~ for $command in $commands ~}}
119120
services.AddSingleton<{{ if $command.CommandTypeNamespace != CommandNamespaceName }}{{$command.CommandTypeNamespace}}.{{ end }}{{$command.CommandTypeName}}>();
@@ -155,7 +156,7 @@ public Task<int> RunAsync(string[] args, CancellationToken cancellationToken)
155156
var logFile = parseResult.GetValue<FileInfo?>(GitVersionSettings.LogFileOption);
156157
var verbosity = parseResult.GetValue<Verbosity?>(GitVersionSettings.VerbosityOption) ?? Verbosity.Normal;
157158
158-
// LoggingEnricher.Configure(logFile?.FullName, verbosity);
159+
LoggingEnricher.Configure(logFile?.FullName, verbosity);
159160
160161
return parseResult.InvokeAsync(cancellationToken: cancellationToken);
161162
}

0 commit comments

Comments
 (0)