-
Notifications
You must be signed in to change notification settings - Fork 932
Show --log-level debug hint when pipeline fails #12603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
e250adf
55a1724
e8bed6c
a2313fd
d8a8b60
47810f2
44ca5e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ internal sealed class ConsoleActivityLogger | |
| { | ||
| private readonly bool _enableColor; | ||
| private readonly ICliHostEnvironment _hostEnvironment; | ||
| private readonly string _commandName; | ||
| private readonly object _lock = new(); | ||
| private readonly Stopwatch _stopwatch = Stopwatch.StartNew(); | ||
| private readonly Dictionary<string, string> _stepColors = new(); | ||
|
|
@@ -43,10 +44,11 @@ internal sealed class ConsoleActivityLogger | |
| private const string InProgressSymbol = "→"; | ||
| private const string InfoSymbol = "i"; | ||
|
|
||
| public ConsoleActivityLogger(ICliHostEnvironment hostEnvironment, bool? forceColor = null) | ||
| public ConsoleActivityLogger(ICliHostEnvironment hostEnvironment, string commandName, bool? forceColor = null) | ||
| { | ||
| _hostEnvironment = hostEnvironment; | ||
| _enableColor = forceColor ?? _hostEnvironment.SupportsAnsi; | ||
| _commandName = commandName; | ||
|
|
||
| // Disable spinner in non-interactive environments | ||
| if (!_hostEnvironment.SupportsInteractiveOutput) | ||
|
|
@@ -252,20 +254,31 @@ public void WriteSummary() | |
| if (!string.IsNullOrEmpty(_finalStatusHeader)) | ||
| { | ||
| AnsiConsole.MarkupLine(_finalStatusHeader!); | ||
|
|
||
| // If pipeline failed, show help message about using --log-level debug | ||
| if (!_pipelineSucceeded) | ||
| { | ||
| var helpMessage = _enableColor | ||
| ? $"[dim]For more details, re-run with: aspire {_commandName} --log-level debug[/]" | ||
| : $"For more details, re-run with: aspire {_commandName} --log-level debug"; | ||
| AnsiConsole.MarkupLine(helpMessage); | ||
| } | ||
| } | ||
| AnsiConsole.MarkupLine(line); | ||
| AnsiConsole.WriteLine(); // Ensure final newline after deployment summary | ||
| } | ||
| } | ||
|
|
||
| private string? _finalStatusHeader; | ||
| private bool _pipelineSucceeded; | ||
|
||
|
|
||
| /// <summary> | ||
| /// Sets the final deployment result lines to be displayed in the summary (e.g., DEPLOYMENT FAILED ...). | ||
| /// Optional usage so existing callers remain compatible. | ||
| /// </summary> | ||
| public void SetFinalResult(bool succeeded) | ||
| { | ||
| _pipelineSucceeded = succeeded; | ||
| // Always show only a single final header line with symbol; no per-step duplication. | ||
| if (succeeded) | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The new field
_commandNameis placed between_hostEnvironmentand_lock, disrupting the logical grouping of fields. Consider placing_commandNameimmediately after_hostEnvironment(line 20) and before_lockto maintain better field organization, as both_hostEnvironmentand_commandNameare constructor parameters that store configuration, while_lockbegins the section of runtime state fields.