mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C#: Remove progress monitor from dependency fetcher, use logger directly
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using Semmle.Util;
|
||||
using Semmle.Util.Logging;
|
||||
|
||||
namespace Semmle.Extraction.CSharp.DependencyFetching
|
||||
{
|
||||
@@ -15,7 +16,7 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
|
||||
// </summary>
|
||||
internal partial class FileContent
|
||||
{
|
||||
private readonly ProgressMonitor progressMonitor;
|
||||
private readonly ILogger logger;
|
||||
private readonly IUnsafeFileReader unsafeFileReader;
|
||||
private readonly IEnumerable<string> files;
|
||||
private readonly HashSet<string> allPackages = new HashSet<string>();
|
||||
@@ -90,18 +91,18 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
|
||||
}
|
||||
}
|
||||
|
||||
internal FileContent(ProgressMonitor progressMonitor,
|
||||
internal FileContent(ILogger logger,
|
||||
IEnumerable<string> files,
|
||||
IUnsafeFileReader unsafeFileReader)
|
||||
{
|
||||
this.progressMonitor = progressMonitor;
|
||||
this.logger = logger;
|
||||
this.files = files;
|
||||
this.unsafeFileReader = unsafeFileReader;
|
||||
this.initialize = new Initializer(DoInitialize);
|
||||
}
|
||||
|
||||
|
||||
public FileContent(ProgressMonitor progressMonitor, IEnumerable<string> files) : this(progressMonitor, files, new UnsafeFileReader())
|
||||
public FileContent(ILogger logger, IEnumerable<string> files) : this(logger, files, new UnsafeFileReader())
|
||||
{ }
|
||||
|
||||
private static string GetGroup(ReadOnlySpan<char> input, ValueMatch valueMatch, string groupPrefix, bool toLower)
|
||||
@@ -192,8 +193,8 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
progressMonitor.LogInfo($"Failed to read file {file}");
|
||||
progressMonitor.LogDebug($"Failed to read file {file}, exception: {ex}");
|
||||
logger.LogInfo($"Failed to read file {file}");
|
||||
logger.LogDebug($"Failed to read file {file}, exception: {ex}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user