11using System ;
22using System . Collections . Generic ;
3+ using System . Diagnostics ;
34using Semmle . BuildAnalyser ;
45using Semmle . Util . Logging ;
56
@@ -56,7 +57,6 @@ public static int Main(string[] args)
5657
5758 var options = Options . Create ( args ) ;
5859 // options.CIL = true; // To do: Enable this
59- using var output = new ConsoleLogger ( options . Verbosity ) ;
6060
6161 if ( options . Help )
6262 {
@@ -67,31 +67,33 @@ public static int Main(string[] args)
6767 if ( options . Errors )
6868 return 1 ;
6969
70- var start = DateTime . Now ;
70+ var stopwatch = new Stopwatch ( ) ;
71+ stopwatch . Start ( ) ;
7172
72- output . Log ( Severity . Info , "Running C# standalone extractor" ) ;
73- using var a = new Analysis ( output , options ) ;
73+ using var logger = new ConsoleLogger ( options . Verbosity ) ;
74+ logger . Log ( Severity . Info , "Running C# standalone extractor" ) ;
75+ using var a = new Analysis ( logger , options ) ;
7476 var sourceFileCount = a . Extraction . Sources . Count ;
7577
7678 if ( sourceFileCount == 0 )
7779 {
78- output . Log ( Severity . Error , "No source files found" ) ;
80+ logger . Log ( Severity . Error , "No source files found" ) ;
7981 return 1 ;
8082 }
8183
8284 if ( ! options . SkipExtraction )
8385 {
84- using var fileLogger = new FileLogger ( options . Verbosity , Extractor . GetCSharpLogPath ( ) ) ;
86+ using var fileLogger = Extractor . MakeLogger ( options . Verbosity , false ) ;
8587
86- output . Log ( Severity . Info , "" ) ;
87- output . Log ( Severity . Info , "Extracting..." ) ;
88+ logger . Log ( Severity . Info , "" ) ;
89+ logger . Log ( Severity . Info , "Extracting..." ) ;
8890 Extractor . ExtractStandalone (
8991 a . Extraction . Sources ,
9092 a . References ,
91- new ExtractionProgress ( output ) ,
93+ new ExtractionProgress ( logger ) ,
9294 fileLogger ,
9395 options ) ;
94- output . Log ( Severity . Info , $ "Extraction completed in { DateTime . Now - start } ") ;
96+ logger . Log ( Severity . Info , $ "Extraction completed in { stopwatch . Elapsed } ") ;
9597 }
9698
9799 return 0 ;
0 commit comments