Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Aspire.Dashboard/Components/Pages/ConsoleLogs.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,10 @@ private void LoadLogs(ConsoleLogsSubscription newConsoleLogsSubscription)
{
lock (_updateLogsLock)
{
foreach (var priorPause in PauseManager.ConsoleLogPauseIntervals)
var pauseIntervals = PauseManager.ConsoleLogPauseIntervals;
Logger.LogDebug("Adding {PauseIntervalsCount} pause intervals on initial logs load.", pauseIntervals.Length);

foreach (var priorPause in pauseIntervals)
{
_logEntries.InsertSorted(LogEntry.CreatePause(priorPause.Start, priorPause.End));
}
Expand Down Expand Up @@ -660,6 +663,8 @@ private async Task ClearConsoleLogs(ApplicationKey? key)

private void OnPausedChanged(bool isPaused)
{
Logger.LogDebug("Console logs paused new value: {IsPausedNewValue}", isPaused);

var timestamp = DateTime.UtcNow;
PauseManager.SetConsoleLogsPaused(isPaused, timestamp);

Expand All @@ -669,12 +674,15 @@ private void OnPausedChanged(bool isPaused)
{
if (isPaused)
{
Logger.LogDebug("Inserting new pause log entry starting at {StartTimestamp}.", timestamp);
_logEntries.InsertSorted(LogEntry.CreatePause(timestamp));
}
else
{
var pause = _logEntries.GetEntries().Last().Pause;
Debug.Assert(pause is not null);

Logger.LogDebug("Updating pause log entry starting at {StartTimestamp} with end of {EndTimestamp}.", pause.StartTime, timestamp);
pause.EndTime = timestamp;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,9 @@ public void PauseResumeButton_TogglePauseResume_LogsPausedAndResumed()
cut.WaitForState(() => instance.PageViewModel.SelectedResource == testResource);

logger.LogInformation("Pause logs.");
var pauseResumeButton = cut.FindComponent<PauseIncomingDataSwitch>();
pauseResumeButton.Find("fluent-button").Click();
var pauseResumeButton = cut.FindComponent<PauseIncomingDataSwitch>().WaitForElement("fluent-button");
pauseResumeButton.Click();
cut.WaitForAssertion(() => Assert.True(pauseManager.ConsoleLogsPaused));

logger.LogInformation("Wait for pause log.");
var pauseConsoleLogLine = cut.WaitForElement(".log-pause");
Expand All @@ -477,8 +478,8 @@ public void PauseResumeButton_TogglePauseResume_LogsPausedAndResumed()
// - the pause line has been replaced with pause details
// - the log viewer shows the new log
// - the log viewer does not show the discarded log
pauseResumeButton.Find("fluent-button").Click();
cut.WaitForAssertion(() => Assert.False(Services.GetRequiredService<PauseManager>().ConsoleLogsPaused));
pauseResumeButton.Click();
cut.WaitForAssertion(() => Assert.False(pauseManager.ConsoleLogsPaused));

logger.LogInformation("Write a new log.");
var resumeContent = $"{DateTime.UtcNow:yyyy-MM-ddTHH:mm:ss.fffK} Log after resume";
Expand Down