2026-05-26 22:14:28 +00:00
|
|
|
using ConsoleLogStreaming.Contracts;
|
|
|
|
|
using ConsoleLogStreaming.Core;
|
|
|
|
|
using ConsoleLogStreaming.Core.DependencyInjection;
|
|
|
|
|
using ConsoleLogStreaming.Core.Options;
|
|
|
|
|
using ConsoleLogStreaming.SignalR;
|
|
|
|
|
using ConsoleLogStreaming.SignalR.DependencyInjection;
|
|
|
|
|
using Elsa.Diagnostics.ConsoleLogs.RealTime;
|
2026-05-25 09:49:51 +00:00
|
|
|
using Elsa.Diagnostics.ConsoleLogs.Services;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
|
|
|
|
|
|
|
|
|
namespace Elsa.Diagnostics.ConsoleLogs.Extensions;
|
|
|
|
|
|
|
|
|
|
public static class HostServiceCollectionExtensions
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2026-05-26 22:14:28 +00:00
|
|
|
/// Registers the host-level console capture pipeline.
|
2026-05-25 09:49:51 +00:00
|
|
|
/// </summary>
|
2026-05-26 22:14:28 +00:00
|
|
|
public static IServiceCollection AddConsoleLogsHost(this IServiceCollection services, Action<ConsoleLogOptions>? configure = null)
|
2026-05-25 09:49:51 +00:00
|
|
|
{
|
2026-05-26 22:14:28 +00:00
|
|
|
services.AddConsoleLogContextServices();
|
|
|
|
|
services.AddConsoleLogStreamingHost(options =>
|
|
|
|
|
{
|
|
|
|
|
ElsaConsoleLogOptions.ConfigureDefaults(options);
|
|
|
|
|
configure?.Invoke(options);
|
|
|
|
|
});
|
|
|
|
|
services.AddConsoleLogStreamingSignalR(options => options.HubPath = EndpointRouteBuilderExtensions.HubRoute);
|
|
|
|
|
services.TryAddSingleton<IConsoleLogStreamingHubAuthorizer, ElsaConsoleLogStreamingHubAuthorizer>();
|
|
|
|
|
services.TryAddSingleton<ElsaConsoleLogSubscriptionManager>();
|
2026-05-25 09:49:51 +00:00
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
}
|