@@ -12,121 +12,101 @@ public ProgressMonitor(ILogger logger)
1212 this . logger = logger ;
1313 }
1414
15- public void FindingFiles ( string dir )
16- {
17- logger . Log ( Severity . Info , "Finding files in {0}..." , dir ) ;
18- }
15+ public void Log ( Severity severity , string message ) =>
16+ logger . Log ( severity , message ) ;
17+
18+ public void LogInfo ( string message ) =>
19+ logger . Log ( Severity . Info , message ) ;
20+
21+ private void LogDebug ( string message ) =>
22+ logger . Log ( Severity . Debug , message ) ;
23+
24+ private void LogError ( string message ) =>
25+ logger . Log ( Severity . Error , message ) ;
26+
27+ public void FindingFiles ( string dir ) =>
28+ LogInfo ( $ "Finding files in { dir } ...") ;
1929
2030 public void IndexingReferences ( int count )
2131 {
22- logger . Log ( Severity . Info , "Indexing..." ) ;
23- logger . Log ( Severity . Debug , "Indexing {0 } DLLs..." , count ) ;
32+ LogInfo ( "Indexing..." ) ;
33+ LogDebug ( $ "Indexing { count } DLLs...") ;
2434 }
2535
2636 public void UnresolvedReference ( string id , string project )
2737 {
28- logger . Log ( Severity . Info , "Unresolved reference {0}" , id ) ;
29- logger . Log ( Severity . Debug , "Unresolved {0 } referenced by {1}" , id , project ) ;
38+ LogInfo ( $ "Unresolved reference { id } " ) ;
39+ LogDebug ( $ "Unresolved { id } referenced by { project } " ) ;
3040 }
3141
32- public void AnalysingSolution ( string filename )
33- {
34- logger . Log ( Severity . Info , $ "Analyzing { filename } ...") ;
35- }
42+ public void AnalysingSolution ( string filename ) =>
43+ LogInfo ( $ "Analyzing { filename } ...") ;
3644
37- public void FailedProjectFile ( string filename , string reason )
38- {
39- logger . Log ( Severity . Info , "Couldn't read project file {0}: {1}" , filename , reason ) ;
40- }
45+ public void FailedProjectFile ( string filename , string reason ) =>
46+ LogInfo ( $ "Couldn't read project file { filename } : { reason } ") ;
4147
4248 public void FailedNugetCommand ( string exe , string args , string message )
4349 {
44- logger . Log ( Severity . Info , "Command failed: {0 } {1}" , exe , args ) ;
45- logger . Log ( Severity . Info , " {0}" , message ) ;
50+ LogInfo ( $ "Command failed: { exe } { args } " ) ;
51+ LogInfo ( $ " { message } " ) ;
4652 }
4753
48- public void NugetInstall ( string package )
49- {
50- logger . Log ( Severity . Info , "Restoring {0}..." , package ) ;
51- }
54+ public void NugetInstall ( string package ) =>
55+ LogInfo ( $ "Restoring { package } ...") ;
5256
53- public void ResolvedReference ( string filename )
54- {
55- logger . Log ( Severity . Info , "Resolved {0}" , filename ) ;
56- }
57+ public void ResolvedReference ( string filename ) =>
58+ LogInfo ( $ "Resolved { filename } ") ;
5759
5860 public void Summary ( int existingSources , int usedSources , int missingSources ,
5961 int references , int unresolvedReferences ,
6062 int resolvedConflicts , int totalProjects , int failedProjects ,
6163 TimeSpan analysisTime )
6264 {
63- logger . Log ( Severity . Info , "" ) ;
64- logger . Log ( Severity . Info , "Build analysis summary:" ) ;
65- logger . Log ( Severity . Info , "{0, 6} source files in the filesystem" , existingSources ) ;
66- logger . Log ( Severity . Info , "{0, 6} source files in project files" , usedSources ) ;
67- logger . Log ( Severity . Info , "{0, 6} sources missing from project files" , missingSources ) ;
68- logger . Log ( Severity . Info , "{0, 6} resolved references" , references ) ;
69- logger . Log ( Severity . Info , "{0, 6} unresolved references" , unresolvedReferences ) ;
70- logger . Log ( Severity . Info , "{0, 6} resolved assembly conflicts" , resolvedConflicts ) ;
71- logger . Log ( Severity . Info , "{0, 6} projects" , totalProjects ) ;
72- logger . Log ( Severity . Info , "{0, 6} missing/failed projects" , failedProjects ) ;
73- logger . Log ( Severity . Info , "Build analysis completed in {0}" , analysisTime ) ;
65+ const int align = 6 ;
66+ LogInfo ( "" ) ;
67+ LogInfo ( "Build analysis summary:" ) ;
68+ LogInfo ( $ "{ existingSources , align } source files in the filesystem") ;
69+ LogInfo ( $ "{ usedSources , align } source files in project files") ;
70+ LogInfo ( $ "{ missingSources , align } sources missing from project files") ;
71+ LogInfo ( $ "{ references , align } resolved references") ;
72+ LogInfo ( $ "{ unresolvedReferences , align } unresolved references") ;
73+ LogInfo ( $ "{ resolvedConflicts , align } resolved assembly conflicts") ;
74+ LogInfo ( $ "{ totalProjects , align } projects") ;
75+ LogInfo ( $ "{ failedProjects , align } missing/failed projects") ;
76+ LogInfo ( $ "Build analysis completed in { analysisTime } ") ;
7477 }
7578
76- public void Log ( Severity severity , string message )
77- {
78- logger . Log ( severity , message ) ;
79- }
79+ public void ResolvedConflict ( string asm1 , string asm2 ) =>
80+ LogDebug ( $ "Resolved { asm1 } as { asm2 } ") ;
8081
81- public void ResolvedConflict ( string asm1 , string asm2 )
82- {
83- logger . Log ( Severity . Debug , "Resolved {0} as {1}" , asm1 , asm2 ) ;
84- }
82+ public void MissingProject ( string projectFile ) =>
83+ LogInfo ( $ "Solution is missing { projectFile } ") ;
8584
86- public void MissingProject ( string projectFile )
87- {
88- logger . Log ( Severity . Info , "Solution is missing {0}" , projectFile ) ;
89- }
85+ public void CommandFailed ( string exe , string arguments , int exitCode ) =>
86+ LogError ( $ "Command { exe } { arguments } failed with exit code { exitCode } ") ;
9087
91- public void CommandFailed ( string exe , string arguments , int exitCode )
92- {
93- logger . Log ( Severity . Error , $ "Command { exe } { arguments } failed with exit code { exitCode } ") ;
94- }
88+ public void MissingNuGet ( ) =>
89+ LogError ( "Missing nuget.exe" ) ;
9590
96- public void MissingNuGet ( )
97- {
98- logger . Log ( Severity . Error , "Missing nuget.exe" ) ;
99- }
100-
101- public void MissingDotNet ( )
102- {
103- logger . Log ( Severity . Error , "Missing dotnet CLI" ) ;
104- }
91+ public void MissingDotNet ( ) =>
92+ LogError ( "Missing dotnet CLI" ) ;
10593
106- public void RunningProcess ( string command )
107- {
108- logger . Log ( Severity . Info , $ "Running { command } ") ;
109- }
94+ public void RunningProcess ( string command ) =>
95+ LogInfo ( $ "Running { command } ") ;
11096
111- public void FailedToRestoreNugetPackage ( string package )
112- {
113- logger . Log ( Severity . Info , $ "Failed to restore nuget package { package } ") ;
114- }
97+ public void FailedToRestoreNugetPackage ( string package ) =>
98+ LogInfo ( $ "Failed to restore nuget package { package } ") ;
11599
116100 public void FailedToReadFile ( string file , Exception ex )
117101 {
118- logger . Log ( Severity . Info , $ "Failed to read file { file } ") ;
119- logger . Log ( Severity . Debug , $ "Failed to read file { file } , exception: { ex } ") ;
102+ LogInfo ( $ "Failed to read file { file } ") ;
103+ LogDebug ( $ "Failed to read file { file } , exception: { ex } ") ;
120104 }
121105
122- public void MultipleNugetConfig ( string [ ] nugetConfigs )
123- {
124- logger . Log ( Severity . Info , $ "Found multiple nuget.config files: { string . Join ( ", " , nugetConfigs ) } .") ;
125- }
106+ public void MultipleNugetConfig ( string [ ] nugetConfigs ) =>
107+ LogInfo ( $ "Found multiple nuget.config files: { string . Join ( ", " , nugetConfigs ) } .") ;
126108
127- internal void NoTopLevelNugetConfig ( )
128- {
129- logger . Log ( Severity . Info , $ "Could not find a top-level nuget.config file.") ;
130- }
109+ internal void NoTopLevelNugetConfig ( ) =>
110+ LogInfo ( "Could not find a top-level nuget.config file." ) ;
131111 }
132112}
0 commit comments