1
1
using System ;
2
2
using System . Collections . Generic ;
3
+ using System . Diagnostics ;
3
4
using Semmle . BuildAnalyser ;
4
5
using Semmle . Util . Logging ;
5
6
@@ -56,7 +57,6 @@ public static int Main(string[] args)
56
57
57
58
var options = Options . Create ( args ) ;
58
59
// options.CIL = true; // To do: Enable this
59
- using var output = new ConsoleLogger ( options . Verbosity ) ;
60
60
61
61
if ( options . Help )
62
62
{
@@ -67,31 +67,33 @@ public static int Main(string[] args)
67
67
if ( options . Errors )
68
68
return 1 ;
69
69
70
- var start = DateTime . Now ;
70
+ var stopwatch = new Stopwatch ( ) ;
71
+ stopwatch . Start ( ) ;
71
72
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 ) ;
74
76
var sourceFileCount = a . Extraction . Sources . Count ;
75
77
76
78
if ( sourceFileCount == 0 )
77
79
{
78
- output . Log ( Severity . Error , "No source files found" ) ;
80
+ logger . Log ( Severity . Error , "No source files found" ) ;
79
81
return 1 ;
80
82
}
81
83
82
84
if ( ! options . SkipExtraction )
83
85
{
84
- using var fileLogger = new FileLogger ( options . Verbosity , Extractor . GetCSharpLogPath ( ) ) ;
86
+ using var fileLogger = Extractor . MakeLogger ( options . Verbosity , false ) ;
85
87
86
- output . Log ( Severity . Info , "" ) ;
87
- output . Log ( Severity . Info , "Extracting..." ) ;
88
+ logger . Log ( Severity . Info , "" ) ;
89
+ logger . Log ( Severity . Info , "Extracting..." ) ;
88
90
Extractor . ExtractStandalone (
89
91
a . Extraction . Sources ,
90
92
a . References ,
91
- new ExtractionProgress ( output ) ,
93
+ new ExtractionProgress ( logger ) ,
92
94
fileLogger ,
93
95
options ) ;
94
- output . Log ( Severity . Info , $ "Extraction completed in { DateTime . Now - start } ") ;
96
+ logger . Log ( Severity . Info , $ "Extraction completed in { stopwatch . Elapsed } ") ;
95
97
}
96
98
97
99
return 0 ;
0 commit comments