diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Extractor/Extractor.cs b/csharp/extractor/Semmle.Extraction.CSharp/Extractor/Extractor.cs index 197baf6543e9..8eb16cb6e46a 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Extractor/Extractor.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Extractor/Extractor.cs @@ -96,8 +96,10 @@ public static ILogger MakeLogger(Verbosity verbosity, bool includeConsole) public static ExitCode Run(string[] args) { var options = Options.CreateWithEnvironment(args); + using var logger = MakeLogger(options.Verbosity, options.Console); if (options.BinaryLogPath is string binlogPath) { + logger.LogInfo($"Reading compiler calls from binary log {binlogPath}"); using var fileStream = new FileStream(binlogPath, FileMode.Open, FileAccess.Read, FileShare.Read); // Filter out compiler calls that aren't interesting for examination @@ -121,11 +123,13 @@ public static ExitCode Run(string[] args) var exitCode = ExitCode.Ok; foreach (var compilerCall in compilerCalls) { - Console.WriteLine($"Processing {compilerCall.GetDiagnosticName()}"); + var diagnosticName = compilerCall.GetDiagnosticName(); + Console.WriteLine($"Processing {diagnosticName}"); var compilerCallOptions = Options.CreateWithEnvironment([]); compilerCallOptions.CompilerName = compilerCall.CompilerFilePath; compilerCallOptions.CompilerArguments.AddRange(compilerCall.GetArguments()); - var ec = Run(compilerCallOptions); + logger.LogInfo($"Running extractor on arguments from binary log. Processing {diagnosticName}."); + var ec = Run(compilerCallOptions, logger); if (ec != ExitCode.Ok) { exitCode = ec; @@ -136,19 +140,17 @@ public static ExitCode Run(string[] args) } else { - return Run(options); + return Run(options, logger); } } - public static ExitCode Run(Options options) + public static ExitCode Run(Options options, ILogger logger) { var stopwatch = new Stopwatch(); stopwatch.Start(); var workingDirectory = Directory.GetCurrentDirectory(); var compilerArgs = options.CompilerArguments.ToArray(); - using var logger = MakeLogger(options.Verbosity, options.Console); - var canonicalPathCache = CanonicalPathCache.Create(logger, 1000); var pathTransformer = new PathTransformer(canonicalPathCache);