diff --git a/src/EventStore.Plugins/EventStore.Plugins.csproj b/src/EventStore.Plugins/EventStore.Plugins.csproj index 1fa68bb..67a6634 100644 --- a/src/EventStore.Plugins/EventStore.Plugins.csproj +++ b/src/EventStore.Plugins/EventStore.Plugins.csproj @@ -3,7 +3,6 @@ net8.0 latest true - AnyCPU true enable enable diff --git a/src/EventStore.Plugins/Plugin.cs b/src/EventStore.Plugins/Plugin.cs index 7186493..c73452b 100644 --- a/src/EventStore.Plugins/Plugin.cs +++ b/src/EventStore.Plugins/Plugin.cs @@ -95,20 +95,13 @@ IServiceCollection IPlugableComponent.ConfigureServices(IServiceCollection servi } IApplicationBuilder IPlugableComponent.Configure(IApplicationBuilder app) { + PublishDiagnostics(new() { ["enabled"] = Enabled }); + var logger = app.ApplicationServices.GetRequiredService().CreateLogger(GetType()); var license = app.ApplicationServices.GetService(); - - if (Enabled && LicensePublicKey is not null && (license is null || !license.IsValid(LicensePublicKey))) { + if (Enabled && LicensePublicKey is not null && (license is null || !license.IsValid(LicensePublicKey))) throw new PluginLicenseException(Name); - - // logger.LogCritical( - // "A valid license is required but was not found. " + - // "Please obtain a license or disable the plugin." - // ); - // - // return app; - } if (!Enabled) { logger.LogInformation( @@ -118,22 +111,23 @@ IApplicationBuilder IPlugableComponent.Configure(IApplicationBuilder app) { return app; } - + logger.LogInformation("{Version} plugin enabled.", Version); ConfigureApplication(app, Configuration); + + PublishDiagnostics(new() { ["enabled"] = Enabled }); return app; } protected internal void PublishDiagnostics(string eventName, Dictionary eventData) { - // if (DiagnosticListener.IsEnabled(nameof(PluginDiagnosticsData))) DiagnosticListener.Write( - nameof(PluginDiagnosticsData), + nameof(PluginDiagnosticsData), new PluginDiagnosticsData( - DiagnosticsName, - eventName, - eventData, + DiagnosticsName, + eventName, + eventData, DateTimeOffset.UtcNow ) );