< Summary

Information
Class: Elsa.Diagnostics.StructuredLogs.Services.DefaultStructuredLogProvider
Assembly: Elsa.Diagnostics.StructuredLogs
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Diagnostics.StructuredLogs/Services/DefaultStructuredLogProvider.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 38
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
PublishAsync()100%11100%
GetRecentAsync(...)100%11100%
SubscribeAsync()100%44100%
SubscribeWithDroppedEventsAsync(...)100%11100%
ListSourcesAsync(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Diagnostics.StructuredLogs/Services/DefaultStructuredLogProvider.cs

#LineLine coverage
 1using System.Runtime.CompilerServices;
 2using Elsa.Diagnostics.StructuredLogs.Contracts;
 3using Elsa.Diagnostics.StructuredLogs.Models;
 4
 5namespace Elsa.Diagnostics.StructuredLogs.Services;
 6
 77public class DefaultStructuredLogProvider(IStructuredLogStore store, IStructuredLogLiveFeed liveFeed) : IStructuredLogSt
 8{
 9    public async ValueTask PublishAsync(StructuredLogEvent logEvent, CancellationToken cancellationToken = default)
 10    {
 111        await store.WriteAsync(logEvent, cancellationToken);
 112        await liveFeed.PublishAsync(logEvent, cancellationToken);
 113    }
 14
 15    public ValueTask<RecentStructuredLogsResult> GetRecentAsync(StructuredLogFilter filter, CancellationToken cancellati
 16    {
 117        return store.QueryAsync(filter, cancellationToken);
 18    }
 19
 20    public async IAsyncEnumerable<StructuredLogEvent> SubscribeAsync(StructuredLogFilter filter, [EnumeratorCancellation
 21    {
 822        await foreach (var item in SubscribeWithDroppedEventsAsync(filter, cancellationToken))
 23        {
 324            if (item.LogEvent != null)
 225                yield return item.LogEvent;
 26        }
 127    }
 28
 29    public IAsyncEnumerable<StructuredLogStreamItem> SubscribeWithDroppedEventsAsync(StructuredLogFilter filter, Cancell
 30    {
 231        return liveFeed.SubscribeAsync(filter, cancellationToken);
 32    }
 33
 34    public ValueTask<IReadOnlyCollection<StructuredLogSource>> ListSourcesAsync(CancellationToken cancellationToken = de
 35    {
 136        return store.ListSourcesAsync(cancellationToken);
 37    }
 38}