Skip to content

Commit ac359d7

Browse files
committed
Put messages under tasks in a subfolder
1 parent 5e5f5f6 commit ac359d7

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/StructuredLogger/Analyzers/BuildAnalyzer.cs

+23
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,29 @@ private void AnalyzeTask(Task task)
371371

372372
fileCopyMap.AnalyzeTask(task);
373373
doubleWritesAnalyzer.AnalyzeTask(task);
374+
375+
CollapseMessagesToSubfolder(task);
376+
}
377+
378+
private void CollapseMessagesToSubfolder(Task task)
379+
{
380+
var messages = task.Children.OfType<Message>().ToArray();
381+
if (messages.Length > 10)
382+
{
383+
for (int i = task.Children.Count - 1; i >= 0; i--)
384+
{
385+
if (task.Children[i] is Message)
386+
{
387+
task.Children.RemoveAt(i);
388+
}
389+
}
390+
}
391+
392+
var subfolder = task.GetOrCreateNodeWithName<Folder>(Strings.Messages);
393+
foreach (var message in messages)
394+
{
395+
subfolder.AddChild(message);
396+
}
374397
}
375398

376399
private void UpdateTaskDurations(Task task)

src/StructuredLogger/Strings/Strings.cs

+1
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ public static Match IsFoundConflicts(string text)
618618
public static string Environment => "Environment";
619619
public static string TruncatedEnvironment => "Starting with MSBuild 17.4, only some environment variables are included in the log: the ones read during the build and the ones prefixed with MSBUILD, DOTNET_ or COMPLUS_.\nDefine MSBUILDLOGALLENVIRONMENTVARIABLES to log all environment variables during the build.";
620620
public static string Imports => "Imports";
621+
public static string Messages => "Messages";
621622
public static string DetailedSummary => "Detailed summary";
622623
public static string Parameters => "Parameters";
623624
public static string Results => "Results";

0 commit comments

Comments
 (0)