Class LoggingRegistration
public static class LoggingRegistration
- Inheritance
-
LoggingRegistration
- Inherited Members
Methods
AddQuilt4NetLogging(IServiceCollection, IConfiguration, Action<Quilt4NetLoggingOptions>, string, string)
Register universal telemetry identity (service.name, service.version, deployment.environment, service.instance.id)
on the OpenTelemetry Resource. Applies to traces, logs and metrics.
Also registers Quilt4Net.Toolkit.Features.Logging.Quilt4NetStartupHostedService so apps with an IHost
(including those built via IHostApplicationBuilder, the older IHostBuilder
pattern, or Tharga.Wpf's generic-host setup) emit the startup entry automatically.
Truly no-host contexts should call LogQuilt4NetStartup(IServiceProvider) manually.
public static Quilt4NetLoggingBuilder AddQuilt4NetLogging(this IServiceCollection services, IConfiguration configuration = null, Action<Quilt4NetLoggingOptions> options = null, string environmentName = null, string applicationName = null)
Parameters
servicesIServiceCollectionconfigurationIConfigurationoptionsAction<Quilt4NetLoggingOptions>environmentNamestringapplicationNamestring
Returns
AddQuilt4NetLogging(IHostApplicationBuilder, Action<Quilt4NetLoggingOptions>)
Register universal telemetry identity (service.name, service.version, deployment.environment, service.instance.id) on the OpenTelemetry Resource. Applies to traces, logs and metrics.
public static Quilt4NetLoggingBuilder AddQuilt4NetLogging(this IHostApplicationBuilder builder, Action<Quilt4NetLoggingOptions> options = null)
Parameters
builderIHostApplicationBuilderoptionsAction<Quilt4NetLoggingOptions>
Returns
LogQuilt4NetStartup(IServiceProvider)
Manually emit the Quilt4Net startup log entry. Use this only when the calling code
has no IHost and therefore no IHostedService runs — e.g. a
pure script, a static-Main console without Microsoft.Extensions.Hosting, or a
plain Application.Run WPF app that doesn't build a host.
Apps that DO build an IHost — including those wired via
IHostApplicationBuilder, the older IHostBuilder pattern, or
Tharga.Wpf's generic-host setup — get the startup entry automatically via
Quilt4Net.Toolkit.Features.Logging.Quilt4NetStartupHostedService regardless of which AddQuilt4NetLogging
overload was used to register it (the IServiceCollection overload registers
the hosted service the same as the IHostApplicationBuilder overload).
Calling this method in those contexts produces a duplicate startup entry.
public static void LogQuilt4NetStartup(this IServiceProvider serviceProvider)
Parameters
serviceProviderIServiceProvider