Skip to content

Commit

Permalink
Fix indentation of multiline messages in Terminal Logger. (#9997)
Browse files Browse the repository at this point in the history
Fixes #9996

Context
The multiline messages indentation processing implies that the message will appear in the structured view under the related project. That is not correct for the Quiet verbosity and for couple of other places, such as rendering the immediate message and cases when the project is not determined.

Changes Made
Make the indentation dependent on where the message would be shown.

Testing
Unit tests
  • Loading branch information
AR-May authored Apr 18, 2024
1 parent 195e928 commit dcaa0bb
Show file tree
Hide file tree
Showing 20 changed files with 166 additions and 60 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
]9;4;3;\The plugin credential provider could not acquire credentials.Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
project failed with 1 error(s) and 1 warning(s) (0.2s)
project failed with 1 error(s) and 2 warning(s) (0.2s)
High importance message!
directory/file(1,2,3,4): warning AA0000: Warning!
directory/file(1,2,3,4): warning AA0000:
A
Multi
Line
Warning!
directory/file(1,2,3,4): error AA0000: Error!
[?25l
[?25h
Build failed with 1 error(s) and 1 warning(s) in 5.0s
Build failed with 1 error(s) and 2 warning(s) in 5.0s
]9;4;0;\
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
The plugin credential provider could not acquire credentials.Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
project failed with 1 error(s) and 1 warning(s) (0.2s)
project failed with 1 error(s) and 2 warning(s) (0.2s)
High importance message!
directory/file(1,2,3,4): warning AA0000: Warning!
directory/file(1,2,3,4): warning AA0000:
A
Multi
Line
Warning!
directory/file(1,2,3,4): error AA0000: Error!
[?25l
[?25h
Build failed with 1 error(s) and 1 warning(s) in 5.0s
Build failed with 1 error(s) and 2 warning(s) in 5.0s
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
]9;4;3;\The plugin credential provider could not acquire credentials.Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
project failed with 1 error(s) and 1 warning(s) (0.2s)
project failed with 1 error(s) and 2 warning(s) (0.2s)
High importance message!
directory/file(1,2,3,4): warning AA0000: Warning!
directory/file(1,2,3,4): warning AA0000:
A
Multi
Line
Warning!
directory/file(1,2,3,4): error AA0000: Error!
[?25l
[?25h
Build failed with 1 error(s) and 1 warning(s) in 5.0s
Build failed with 1 error(s) and 2 warning(s) in 5.0s
]9;4;0;\
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
]9;4;3;\The plugin credential provider could not acquire credentials.Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
project failed with 1 error(s) and 1 warning(s) (0.2s)
project failed with 1 error(s) and 2 warning(s) (0.2s)
High importance message!
directory/file(1,2,3,4): warning AA0000: Warning!
directory/file(1,2,3,4): warning AA0000:
A
Multi
Line
Warning!
directory/file(1,2,3,4): error AA0000: Error!
[?25l
[?25h
Build failed with 1 error(s) and 1 warning(s) in 5.0s
Build failed with 1 error(s) and 2 warning(s) in 5.0s
]9;4;0;\
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
The plugin credential provider could not acquire credentials.Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
project failed with 1 error(s) and 1 warning(s) (0.2s)
project failed with 1 error(s) and 2 warning(s) (0.2s)
High importance message!
directory/file(1,2,3,4): warning AA0000: Warning!
directory/file(1,2,3,4): warning AA0000:
A
Multi
Line
Warning!
directory/file(1,2,3,4): error AA0000: Error!
[?25l
[?25h
Build failed with 1 error(s) and 1 warning(s) in 5.0s
Build failed with 1 error(s) and 2 warning(s) in 5.0s
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
]9;4;3;\The plugin credential provider could not acquire credentials.Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
project failed with 1 error(s) and 1 warning(s) (0.2s)
project failed with 1 error(s) and 2 warning(s) (0.2s)
High importance message!
directory/file(1,2,3,4): warning AA0000: Warning!
directory/file(1,2,3,4): warning AA0000:
A
Multi
Line
Warning!
directory/file(1,2,3,4): error AA0000: Error!
[?25l
[?25h
Build failed with 1 error(s) and 1 warning(s) in 5.0s
Build failed with 1 error(s) and 2 warning(s) in 5.0s
]9;4;0;\
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
]9;4;3;\The plugin credential provider could not acquire credentials.Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
project failed with 1 error(s) and 1 warning(s) (0.2s)
project failed with 1 error(s) and 2 warning(s) (0.2s)
directory/file(1,2,3,4): warning AA0000: Warning!
directory/file(1,2,3,4): warning AA0000:
A
Multi
Line
Warning!
directory/file(1,2,3,4): error AA0000: Error!
[?25l
[?25h
Build failed with 1 error(s) and 1 warning(s) in 5.0s
Build failed with 1 error(s) and 2 warning(s) in 5.0s
]9;4;0;\
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
The plugin credential provider could not acquire credentials.Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
project failed with 1 error(s) and 1 warning(s) (0.2s)
project failed with 1 error(s) and 2 warning(s) (0.2s)
directory/file(1,2,3,4): warning AA0000: Warning!
directory/file(1,2,3,4): warning AA0000:
A
Multi
Line
Warning!
directory/file(1,2,3,4): error AA0000: Error!
[?25l
[?25h
Build failed with 1 error(s) and 1 warning(s) in 5.0s
Build failed with 1 error(s) and 2 warning(s) in 5.0s
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
]9;4;3;\The plugin credential provider could not acquire credentials.Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
project failed with 1 error(s) and 1 warning(s) (0.2s)
project failed with 1 error(s) and 2 warning(s) (0.2s)
directory/file(1,2,3,4): warning AA0000: Warning!
directory/file(1,2,3,4): warning AA0000:
A
Multi
Line
Warning!
directory/file(1,2,3,4): error AA0000: Error!
[?25l
[?25h
Build failed with 1 error(s) and 1 warning(s) in 5.0s
Build failed with 1 error(s) and 2 warning(s) in 5.0s
]9;4;0;\
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
]9;4;3;\The plugin credential provider could not acquire credentials.Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
project failed with 1 error(s) and 1 warning(s) (0.2s)
project failed with 1 error(s) and 2 warning(s) (0.2s)
directory/file(1,2,3,4): warning AA0000: Warning!
directory/file(1,2,3,4): warning AA0000:
A
Multi
Line
Warning!
directory/file(1,2,3,4): error AA0000: Error!
[?25l
[?25h
Build failed with 1 error(s) and 1 warning(s) in 5.0s
Build failed with 1 error(s) and 2 warning(s) in 5.0s
]9;4;0;\
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
The plugin credential provider could not acquire credentials.Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
project failed with 1 error(s) and 1 warning(s) (0.2s)
project failed with 1 error(s) and 2 warning(s) (0.2s)
directory/file(1,2,3,4): warning AA0000: Warning!
directory/file(1,2,3,4): warning AA0000:
A
Multi
Line
Warning!
directory/file(1,2,3,4): error AA0000: Error!
[?25l
[?25h
Build failed with 1 error(s) and 1 warning(s) in 5.0s
Build failed with 1 error(s) and 2 warning(s) in 5.0s
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
]9;4;3;\The plugin credential provider could not acquire credentials.Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
project failed with 1 error(s) and 1 warning(s) (0.2s)
project failed with 1 error(s) and 2 warning(s) (0.2s)
directory/file(1,2,3,4): warning AA0000: Warning!
directory/file(1,2,3,4): warning AA0000:
A
Multi
Line
Warning!
directory/file(1,2,3,4): error AA0000: Error!
[?25l
[?25h
Build failed with 1 error(s) and 1 warning(s) in 5.0s
Build failed with 1 error(s) and 2 warning(s) in 5.0s
]9;4;0;\
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
]9;4;3;\directory/file(1,2,3,4): warning AA0000: Warning!
directory/file(1,2,3,4): warning AA0000:
A
Multi
Line
Warning!
directory/file(1,2,3,4): error AA0000: Error!
]9;4;0;\
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
directory/file(1,2,3,4): warning AA0000: Warning!
directory/file(1,2,3,4): warning AA0000:
A
Multi
Line
Warning!
directory/file(1,2,3,4): error AA0000: Error!
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
]9;4;3;\directory/file(1,2,3,4): warning AA0000: Warning!
directory/file(1,2,3,4): warning AA0000:
A
Multi
Line
Warning!
directory/file(1,2,3,4): error AA0000: Error!
]9;4;0;\
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
]9;4;3;\The plugin credential provider could not acquire credentials.Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
project failed with 1 error(s) and 1 warning(s) (0.2s)
project failed with 1 error(s) and 2 warning(s) (0.2s)
High importance message!
directory/file(1,2,3,4): warning AA0000: Warning!
directory/file(1,2,3,4): warning AA0000:
A
Multi
Line
Warning!
directory/file(1,2,3,4): error AA0000: Error!
[?25l
[?25h
Build failed with 1 error(s) and 1 warning(s) in 5.0s
Build failed with 1 error(s) and 2 warning(s) in 5.0s
]9;4;0;\
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
The plugin credential provider could not acquire credentials.Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
project failed with 1 error(s) and 1 warning(s) (0.2s)
project failed with 1 error(s) and 2 warning(s) (0.2s)
High importance message!
directory/file(1,2,3,4): warning AA0000: Warning!
directory/file(1,2,3,4): warning AA0000:
A
Multi
Line
Warning!
directory/file(1,2,3,4): error AA0000: Error!
[?25l
[?25h
Build failed with 1 error(s) and 1 warning(s) in 5.0s
Build failed with 1 error(s) and 2 warning(s) in 5.0s
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
]9;4;3;\The plugin credential provider could not acquire credentials.Authentication may require manual action. Consider re-running the command with --interactive for `dotnet`, /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for `NuGet`
project failed with 1 error(s) and 1 warning(s) (0.2s)
project failed with 1 error(s) and 2 warning(s) (0.2s)
High importance message!
directory/file(1,2,3,4): warning AA0000: Warning!
directory/file(1,2,3,4): warning AA0000:
A
Multi
Line
Warning!
directory/file(1,2,3,4): error AA0000: Error!
[?25l
[?25h
Build failed with 1 error(s) and 1 warning(s) in 5.0s
Build failed with 1 error(s) and 2 warning(s) in 5.0s
]9;4;0;\
1 change: 1 addition & 0 deletions src/MSBuild.UnitTests/TerminalLogger_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ private void CallAllTypesOfMessagesWarningAndError()
MessageRaised?.Invoke(_eventSender, MakeMessageEventArgs("Normal importance message!", MessageImportance.Normal));
MessageRaised?.Invoke(_eventSender, MakeMessageEventArgs("Low importance message!", MessageImportance.Low));
WarningRaised?.Invoke(_eventSender, MakeWarningEventArgs("Warning!"));
WarningRaised?.Invoke(_eventSender, MakeWarningEventArgs("A\nMulti\r\nLine\nWarning!"));
ErrorRaised?.Invoke(_eventSender, MakeErrorEventArgs("Error!"));
}

Expand Down
Loading

0 comments on commit dcaa0bb

Please sign in to comment.