Skip to content

Commit

Permalink
Minor fixups in log handling (#1319)
Browse files Browse the repository at this point in the history
I've been looking at the log handling code in preparation to send that data via the network. This commit addresses a few small things.
  • Loading branch information
drewnoakes committed Dec 11, 2023
1 parent 1f56e60 commit 2b69518
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
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

0 comments on commit 2b69518

Please sign in to comment.