2 instantiations of LogEntry
Aspire.Hosting (2)
src\Shared\ConsoleLogs\LogEntry.cs (2)
77
return new
LogEntry
99
return new
LogEntry
77 references to LogEntry
Aspire.Hosting (55)
ApplicationModel\ResourceLoggerService.cs (25)
391
internal void AddLogEntries(string resourceName, IReadOnlyList<
LogEntry
> logEntries, bool inMemorySource, bool skipExisting)
413
private readonly CircularBuffer<
LogEntry
> _inMemoryEntries = new(MaxLogCount);
466
List<
LogEntry
> inMemoryEntries;
490
var channel = Channel.CreateUnbounded<
LogEntry
>();
495
void Log(
LogEntry
log) => channel.Writer.TryWrite(log);
497
LogEntry
[] backlogSnapshot;
506
foreach (
var
logEntry in _inMemoryEntries)
557
var pendingLiveEntries = new List<
LogEntry
>();
559
void Log(
LogEntry
log)
582
LogEntry
[] backlogSnapshot;
591
foreach (
var
logEntry in _inMemoryEntries)
673
private Action<
LogEntry
>? _onNewLog;
674
private event Action<
LogEntry
> OnNewLog
736
internal
LogEntry
[] GetBacklogSnapshot()
744
public void AddLog(
LogEntry
logEntry, bool inMemorySource)
766
public void AddLogs(IReadOnlyList<
LogEntry
> logEntries, bool inMemorySource, bool skipExisting)
773
List<
LogEntry
>? addedEntries = null;
790
foreach (
var
existingEntry in existingEntries)
796
foreach (
var
logEntry in logEntries)
833
foreach (
var
logEntry in addedEntries)
845
private sealed class Subscription(ResourceLoggerState loggerState, Action<
LogEntry
> log) : IDisposable
875
loggerState.AddLog(
LogEntry
.Create(logTime, logMessage, isErrorMessage), inMemorySource: true);
880
private static LogLine[] CreateLogLines(ref int lineNumber, IReadOnlyList<
LogEntry
> entries)
885
var
entry = entries[i];
927
public IAsyncEnumerable<IReadOnlyList<
LogEntry
>> GetAllLogsAsync(string resourceName, CancellationToken cancellationToken)
Dcp\DcpResourceWatcher.cs (12)
482
var logEntries = new List<
LogEntry
>();
600
public async IAsyncEnumerable<IReadOnlyList<
LogEntry
>> GetAllLogsAsync(string resourceName, [EnumeratorCancellation] CancellationToken cancellationToken)
620
var logs = new List<
LogEntry
>();
621
foreach (
var
logEntry in CreateLogEntries(batch))
631
private static IEnumerable<
LogEntry
> CreateLogEntries(IReadOnlyList<ResourceLogEntry> batch)
644
yield return
LogEntry
.Create(timestamp, resolvedContent, entry.RawContent ?? entry.Content, entry.IsErrorMessage, resourcePrefix: null);
754
private void SetPendingFollowLogDeduplication(string resourceName, string? resourceUid, IReadOnlyList<
LogEntry
> flushedLogEntries)
778
foreach (
var
logEntry in flushedLogEntries)
815
private List<
LogEntry
> DeduplicateFollowBatch(string resourceName, LogStreamState logStream, List<
LogEntry
> logEntries)
827
List<
LogEntry
>? addedEntries = null;
828
foreach (
var
logEntry in logEntries)
IConsoleLogsService.cs (1)
10
IAsyncEnumerable<IReadOnlyList<
LogEntry
>> GetAllLogsAsync(string resourceName, CancellationToken cancellationToken);
src\Shared\ConsoleLogs\LogEntries.cs (13)
19
private readonly CircularBuffer<
LogEntry
> _logEntries = new(maximumEntryCount);
27
public IList<
LogEntry
> GetEntries() => _logEntries;
45
foreach (
var
pauseEntry in pauseEntries)
60
public bool ProcessPauseFilters(
LogEntry
logEntry)
90
public void InsertSortedRange(IReadOnlyList<
LogEntry
> logEntries)
94
foreach (
var
logEntry in logEntries)
107
var merged = new List<
LogEntry
>(existing.Count + batch.Count);
136
private bool CanMerge(IReadOnlyList<
LogEntry
> logEntries)
146
foreach (
var
logEntry in logEntries)
161
foreach (
var
existingEntry in _logEntries)
176
public void InsertSorted(
LogEntry
logLine)
219
private int InsertSortedCore(
LogEntry
logEntry)
230
var
current = _logEntries[rowIndex];
src\Shared\ConsoleLogs\LogEntry.cs (4)
75
public static
LogEntry
CreatePause(string resourcePrefix, DateTime startTimestamp, DateTime? endTimestamp = null)
92
public static
LogEntry
Create(DateTime? timestamp, string logMessage, bool isErrorMessage)
97
public static
LogEntry
Create(DateTime? timestamp, string logMessage, string rawLogContent, bool isErrorMessage, string? resourcePrefix)
123
public static LogEntryKey Create(
LogEntry
logEntry)
Aspire.Hosting.Dotnet.Tests (6)
DotnetProjectBuildCoordinatorTests.cs (6)
2221
var output = Channel.CreateUnbounded<IReadOnlyList<
LogEntry
>>();
2222
output.Writer.TryWrite([
LogEntry
.Create(timestamp: null, error, isErrorMessage: false)]);
2280
var firstOutput = Channel.CreateUnbounded<IReadOnlyList<
LogEntry
>>();
2281
firstOutput.Writer.TryWrite([
LogEntry
.Create(timestamp: null, firstError, isErrorMessage: false)]);
2413
var channel = Channel.CreateUnbounded<IReadOnlyList<
LogEntry
>>();
2417
channel.Writer.TryWrite([.. lines.Select(line =>
LogEntry
.Create(timestamp: null, line, isErrorMessage: false))]);
Aspire.Hosting.Tests (13)
Dashboard\DashboardEventHandlersTests.cs (3)
62
dashboardLoggerState.AddLog(
LogEntry
.Create(timestamp, logMessage, isErrorMessage: false), inMemorySource: true);
118
dashboardLoggerState.AddLog(
LogEntry
.Create(timestamp, messageJson, isErrorMessage: false), inMemorySource: true);
133
dashboardLoggerState.AddLog(
LogEntry
.Create(timestamp, sentinelJson, isErrorMessage: false), inMemorySource: true);
Dashboard\DashboardServiceTests.cs (2)
45
var getConsoleLogsChannel = Channel.CreateUnbounded<IReadOnlyList<
LogEntry
>>();
85
await getConsoleLogsChannel.Writer.WriteAsync([
LogEntry
.Create(null, "Test3", isErrorMessage: false)]);
ResourceLoggerServiceTests.cs (8)
263
var consoleLogsChannel0 = Channel.CreateUnbounded<IReadOnlyList<
LogEntry
>>();
264
consoleLogsChannel0.Writer.TryWrite([
LogEntry
.Create(timestamp: null, logMessage: "instance0!", isErrorMessage: false)]);
267
var consoleLogsChannel1 = Channel.CreateUnbounded<IReadOnlyList<
LogEntry
>>();
268
consoleLogsChannel1.Writer.TryWrite([
LogEntry
.Create(timestamp: null, logMessage: "instance1!", isErrorMessage: false)]);
482
var consoleLogsChannel = Channel.CreateUnbounded<IReadOnlyList<
LogEntry
>>();
852
private static
LogEntry
CreateLogEntry(string content)
854
return
LogEntry
.Create(timestamp: null, content, isErrorMessage: false);
857
private static
LogEntry
CreateConcurrentLogEntry(int producerIndex, int entryIndex)
Aspire.Hosting.TestUtilities (3)
Utils\TestConsoleLogsService.cs (3)
12
private readonly Func<string, Channel<IReadOnlyList<
LogEntry
>>>? _getConsoleLogsChannel;
14
public TestConsoleLogsService(Func<string, Channel<IReadOnlyList<
LogEntry
>>>? getConsoleLogsChannel = null)
19
public async IAsyncEnumerable<IReadOnlyList<
LogEntry
>> GetAllLogsAsync(string resourceName, [EnumeratorCancellation] CancellationToken cancellationToken)