Skip to content

Commit a5ce9b1

Browse files
Copilotbaronfel
andcommitted
Fix GitLab logger to only colorize the diagnostic type for better legibility
Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
1 parent fbb6d24 commit a5ce9b1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/MSBuild/CICDLogger/GitLab/GitLabLogger.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,10 @@ protected override void OnBuildFinished(BuildFinishedEventArgs e, GitLabProjectD
300300
private void WriteDiagnostic(string type, string colorCode, string? file, int lineNumber, int columnNumber, string? code, string? message)
301301
{
302302
// GitLab uses ANSI color codes for formatting
303+
// Only colorize the type for better legibility
303304
_write(colorCode); // Color code (red for errors, yellow for warnings)
304305
_write(type);
306+
_write("\x1b[0m"); // Reset color after type
305307
_write(": ");
306308

307309
if (!string.IsNullOrEmpty(file))
@@ -332,7 +334,6 @@ private void WriteDiagnostic(string type, string colorCode, string? file, int li
332334
}
333335

334336
_write(message ?? string.Empty);
335-
_write("\x1b[0m"); // Reset color
336337
_write(Environment.NewLine);
337338
}
338339

0 commit comments

Comments
 (0)