Skip to content

Commit 3141f75

Browse files
ap0llonils-a
authored andcommitted
Colorize the GitLab CI section header
Highlight the section header in the GitLab CI log to make it easier to differentiate between the section header and the log output inside the section
1 parent 9b097a0 commit 3141f75

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Cake.GitLabCI.Module/AnsiEscapeCodes.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ internal static class AnsiEscapeCodes
77
public static readonly string ForegroundYellow = string.Format(FORMAT, 33);
88
public static readonly string ForegroundLightGray = string.Format(FORMAT, 37);
99
public static readonly string ForegroundDarkGray = string.Format(FORMAT, 90);
10+
public static readonly string ForegroundBlue = string.Format(FORMAT, 34);
1011
public static readonly string BackgroundMagenta = string.Format(FORMAT, 45);
1112
public static readonly string BackgroundRed = string.Format(FORMAT, 41);
1213
public static readonly string SectionMarker = "\u001B[0K";

src/Cake.GitLabCI.Module/GitLabCIEngine.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private void OnAfterTeardown(object sender, AfterTeardownEventArgs e)
7575

7676
private void WriteSectionStart(string sectionName, string sectionHeader = null)
7777
{
78-
_console.WriteLine("{0}", $"{AnsiEscapeCodes.SectionMarker}section_start:{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}:{sectionName}\r{AnsiEscapeCodes.SectionMarker}{sectionHeader ?? sectionName}");
78+
_console.WriteLine("{0}", $"{AnsiEscapeCodes.SectionMarker}section_start:{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}:{sectionName}\r{AnsiEscapeCodes.SectionMarker}{AnsiEscapeCodes.ForegroundBlue}{sectionHeader ?? sectionName}{AnsiEscapeCodes.Reset}");
7979
}
8080

8181
private void WriteSectionEnd(string sectionName)

0 commit comments

Comments
 (0)