Skip to content

Commit 55b4d7d

Browse files
committed
fix: disable report printing if verbosity of logger is Quiet
1 parent e2ccd15 commit 55b4d7d

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

src/Cake.Cli/Hosts/BuildScriptHost.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private async Task<CakeReport> internalRunTargetAsync()
8888

8989
if (report != null && !report.IsEmpty)
9090
{
91-
_reportPrinter.Write(report);
91+
_reportPrinter.Write(report, _log.Verbosity);
9292
}
9393

9494
return report;

src/Cake.Cli/Infrastructure/CakeSpectreReportPrinter.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,18 @@ public CakeSpectreReportPrinter(IAnsiConsole console)
2929
}
3030

3131
/// <inheritdoc/>
32-
public void Write(CakeReport report)
32+
public void Write(CakeReport report, Verbosity verbosity)
3333
{
34+
if (report == null)
35+
{
36+
throw new ArgumentNullException(nameof(report));
37+
}
38+
39+
if (verbosity <= Verbosity.Quiet)
40+
{
41+
return;
42+
}
43+
3444
// Create a table
3545
var table = new Table().Border(TableBorder.SimpleHeavy);
3646
table.Width(100);

src/Cake.Core/CakeReportPrinter.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,18 @@ public CakeReportPrinter(IConsole console, ICakeContext context)
3030
}
3131

3232
/// <inheritdoc/>
33-
public void Write(CakeReport report)
33+
public void Write(CakeReport report, Verbosity verbosity)
3434
{
3535
if (report == null)
3636
{
3737
throw new ArgumentNullException(nameof(report));
3838
}
3939

40+
if (verbosity <= Verbosity.Quiet)
41+
{
42+
return;
43+
}
44+
4045
try
4146
{
4247
var maxTaskNameLength = 29;

src/Cake.Core/ICakeReportPrinter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ public interface ICakeReportPrinter
1515
/// Writes the specified report to a target.
1616
/// </summary>
1717
/// <param name="report">The report to write.</param>
18-
void Write(CakeReport report);
18+
/// <param name="verbosity">The <see cref="Verbosity"/> at which the report should be written.</param>
19+
void Write(CakeReport report, Verbosity verbosity);
1920

2021
/// <summary>
2122
/// Writes the specified lifecyle steps (i.e. Setup/TearDown) to a target.

0 commit comments

Comments
 (0)