From 5f43f9661a5417c6c55a4c2c84dc7d531e9a7b7d Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Tue, 4 Jun 2024 16:44:14 +0200 Subject: [PATCH] Log message when binary log is used --- .../Extractor/Extractor.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Extractor/Extractor.cs b/csharp/extractor/Semmle.Extraction.CSharp/Extractor/Extractor.cs index 197baf6543e95..9920253e7cb8c 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Extractor/Extractor.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Extractor/Extractor.cs @@ -121,11 +121,14 @@ 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); + using var logger = MakeLogger(compilerCallOptions.Verbosity, compilerCallOptions.Console); + logger.LogInfo($"Running extractor on arguments from binary log. Processing {diagnosticName}."); + var ec = Run(compilerCallOptions, logger); if (ec != ExitCode.Ok) { exitCode = ec; @@ -136,19 +139,18 @@ public static ExitCode Run(string[] args) } else { - return Run(options); + using var logger = MakeLogger(options.Verbosity, options.Console); + 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);