Skip to content

Commit

Permalink
Add filtering for CI service messages
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoch committed Oct 16, 2021
1 parent a19f7bd commit e0bf251
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,14 @@ protected internal override void ReportError(string text, string details = null)
{
LogIssue(AzurePipelinesIssueType.Error, text);
}

protected internal override bool FilterMessage(string message)
{
if (!message.ContainsOrdinalIgnoreCase("##vso["))
return false;

Console.WriteLine(message);
return true;
}
}
}
9 changes: 9 additions & 0 deletions source/Nuke.Common/CI/GitHubActions/GitHubActions.Theming.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,14 @@ protected internal override void ReportError(string text, string details = null)
{
WriteError(text);
}

protected internal override bool FilterMessage(string message)
{
if (!message.StartsWith("::"))
return false;

Console.WriteLine(message);
return true;
}
}
}
9 changes: 9 additions & 0 deletions source/Nuke.Common/CI/TeamCity/TeamCity.Theming.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,14 @@ protected internal override void ReportError(string text, string details = null)
{
WriteError(text, details);
}

protected internal override bool FilterMessage(string message)
{
if (!message.ContainsOrdinalIgnoreCase("##teamcity["))
return false;

Console.WriteLine(message);
return true;
}
}
}
5 changes: 5 additions & 0 deletions source/Nuke.Common/Execution/Host.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ protected internal virtual void ReportError(string text, string details = null)
{
}

protected internal virtual bool FilterMessage(string message)
{
return false;
}

internal virtual void WriteSummary(NukeBuild build)
{
WriteSevereLogEvents(Logging.InMemorySink.Instance.LogEvents);
Expand Down
1 change: 1 addition & 0 deletions source/Nuke.Common/Execution/Logging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public static void Configure(NukeBuild build = null)
.ConfigureInMemory(build)
.ConfigureFiles(build)
.ConfigureLevel()
.Filter.ByExcluding(x => NukeBuild.Host.FilterMessage(x.MessageTemplate.Text))
.CreateLogger();
}

Expand Down

0 comments on commit e0bf251

Please sign in to comment.