Skip to content

Commit 72d8db8

Browse files
committed
C#: Add some logging messages for lazily computed sets of dependencies.
1 parent ee551a8 commit 72d8db8

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

  • csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/FeedManager.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,29 @@ public FeedManager(ILogger logger, IDotNet dotnet, IRegistryProxy? registryProxy
107107

108108
lazyExplicitFeeds = new Lazy<ImmutableHashSet<string>>(GetExplicitFeeds);
109109
lazyAllFeeds = new Lazy<ImmutableHashSet<string>>(GetAllFeeds);
110-
lazyReachableExplicitFeeds = new Lazy<ImmutableHashSet<string>>(() => CheckSpecifiedFeeds(ExplicitFeeds));
110+
lazyReachableExplicitFeeds = new Lazy<ImmutableHashSet<string>>(() =>
111+
{
112+
logger.LogInfo("Discovering reachable explicit NuGet feeds.");
113+
return CheckSpecifiedFeeds(ExplicitFeeds);
114+
});
111115
lazyReachableFeeds = new Lazy<ImmutableHashSet<string>>(() =>
112116
{
117+
logger.LogInfo("Discovering reachable inherited NuGet feeds.");
113118
// Inherited feeds should only be used, if they are indeed reachable (as they may be environment specific).
114119
var reachableInheritedFeeds = CheckSpecifiedFeeds(InheritedFeeds);
115120
return ReachableExplicitFeeds.Union(reachableInheritedFeeds).ToImmutableHashSet();
116121
});
117122
lazyReachableFallbackFeeds = new Lazy<ImmutableHashSet<string>>(() =>
118123
{
124+
logger.LogInfo("Discovering reachable fallback NuGet feeds.");
119125
var reachableFallbackFeeds = GetReachableFallbackNugetFeeds();
120126
return reachableFallbackFeeds.ToImmutableHashSet();
121127
});
122-
lazyReachableDefaultFeeds = new Lazy<ImmutableHashSet<string>>(() => CheckSpecifiedFeeds(DefaultFeeds));
128+
lazyReachableDefaultFeeds = new Lazy<ImmutableHashSet<string>>(() =>
129+
{
130+
logger.LogInfo("Discovering reachable default NuGet feeds.");
131+
return CheckSpecifiedFeeds(DefaultFeeds);
132+
});
123133
}
124134

125135
public FeedManager(ILogger logger, IDotNet dotnet, IRegistryProxy? registryProxy, IFileProvider fileProvider)
@@ -369,6 +379,7 @@ private List<string> GetReachableFallbackNugetFeeds()
369379

370380
private ImmutableHashSet<string> GetExplicitFeeds()
371381
{
382+
logger.LogInfo("Discovering explicit NuGet feeds from nuget.config files and private registries.");
372383
var nugetConfigs = fileProvider.NugetConfigs;
373384

374385
// Find feeds that are explicitly configured in the NuGet configuration files that we found.
@@ -398,6 +409,8 @@ private ImmutableHashSet<string> GetExplicitFeeds()
398409

399410
private ImmutableHashSet<string> GetAllFeeds()
400411
{
412+
logger.LogInfo("Discovering all NuGet feeds.");
413+
401414
var nugetConfigs = fileProvider.NugetConfigs;
402415

403416
HashSet<string> allFeeds = [];

0 commit comments

Comments
 (0)