Skip to content

Commit

Permalink
Colorize the GitLab CI section header
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ap0llo authored and nils-a committed Sep 30, 2024
1 parent 9b097a0 commit 3141f75
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Cake.GitLabCI.Module/AnsiEscapeCodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ internal static class AnsiEscapeCodes
public static readonly string ForegroundYellow = string.Format(FORMAT, 33);
public static readonly string ForegroundLightGray = string.Format(FORMAT, 37);
public static readonly string ForegroundDarkGray = string.Format(FORMAT, 90);
public static readonly string ForegroundBlue = string.Format(FORMAT, 34);
public static readonly string BackgroundMagenta = string.Format(FORMAT, 45);
public static readonly string BackgroundRed = string.Format(FORMAT, 41);
public static readonly string SectionMarker = "\u001B[0K";
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.GitLabCI.Module/GitLabCIEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private void OnAfterTeardown(object sender, AfterTeardownEventArgs e)

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

private void WriteSectionEnd(string sectionName)
Expand Down

0 comments on commit 3141f75

Please sign in to comment.