Skip to content
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

Minor fixups in log handling #1319

Merged
merged 1 commit into from
Dec 11, 2023
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
2 changes: 1 addition & 1 deletion src/Aspire.Dashboard/ConsoleLogs/TimestampParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ private static string ConvertTimestampFromUtc(ReadOnlySpan<char> timestamp)
[GeneratedRegex("^(?:\\d{4})-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])T(?:[01][0-9]|2[0-3]):(?:[0-5][0-9]):(?:[0-5][0-9])(?:\\.\\d{1,9})?(?:Z|(?:[Z+-](?:[01][0-9]|2[0-3]):(?:[0-5][0-9])))?")]
private static partial Regex GenerateRfc3339RegEx();

public readonly record struct TimestampParserResult(string? ModifiedText, string? Timestamp);
public readonly record struct TimestampParserResult(string ModifiedText, string Timestamp);
}
2 changes: 1 addition & 1 deletion src/Aspire.Dashboard/Otlp/Model/OtlpLogEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public OtlpLogEntry(LogRecord record, OtlpApplication logApp, OtlpScope scope)
// Explicitly ignore these
break;
default:
properties.Add(new KeyValuePair<string, string>(kv.Key, kv.Value.GetString()));
properties.Add(KeyValuePair.Create(kv.Key, kv.Value.GetString()));
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Aspire.Hosting/Dashboard/DockerContainerLogSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public async IAsyncEnumerable<string[]> WatchOutputLogAsync([EnumeratorCancellat
{
if (_containerLogWatcher is not null)
{
await foreach (var logs in _containerLogWatcher!.WatchOutputLogsAsync(cancellationToken).ConfigureAwait(false))
await foreach (var logs in _containerLogWatcher.WatchOutputLogsAsync(cancellationToken).ConfigureAwait(false))
{
yield return logs;
}
Expand All @@ -45,7 +45,7 @@ public async IAsyncEnumerable<string[]> WatchErrorLogAsync([EnumeratorCancellati
{
if (_containerLogWatcher is not null)
{
await foreach (var logs in _containerLogWatcher!.WatchErrorLogsAsync(cancellationToken).ConfigureAwait(false))
await foreach (var logs in _containerLogWatcher.WatchErrorLogsAsync(cancellationToken).ConfigureAwait(false))
{
yield return logs;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Aspire.Hosting/Dashboard/FileLogSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ private static async IAsyncEnumerable<string[]> WatchLogAsync(string filePath, [
while (!cancellationToken.IsCancellationRequested)
{
var reader = PipeReader.Create(fileStream, s_streamPipeReaderOptions);

while (!cancellationToken.IsCancellationRequested)
{
var result = await reader!.ReadAsync(cancellationToken).ConfigureAwait(false);
var result = await reader.ReadAsync(cancellationToken).ConfigureAwait(false);

if (result.IsCompleted)
{
Expand Down
Loading