/// <summary> /// Adds an PostgresTarget as a target to logging the performance counts /// </summary> /// <returns></returns> public static void AddPostgres(this PerformanceLoggerDiOptions options, string connectionString, string tableName = "perflogs") { // Register the batcher as a singleton options.Services.AddSingleton <BatchWriter>(provider => new BatchWriter( connectionString, tableName, provider.GetService <ILogger <BatchWriter> >())); options.Services.Add(ServiceDescriptor.Transient <ITarget, PostgresTarget>()); }
/// <summary> /// Adds an ILogger as a target to logging the performance counts /// </summary> /// <returns></returns> public static void AddLogging(this PerformanceLoggerDiOptions options, Func <IServiceProvider, ILogger> loggerProvider) { options.Services.Add(ServiceDescriptor.Transient <ITarget>(provider => new LoggerTarget(loggerProvider(provider)))); }
/// <summary> /// Adds an ILogger as a target to logging the performance counts /// </summary> /// <returns></returns> public static void AddLogging(this PerformanceLoggerDiOptions options) { options.Services.Add(ServiceDescriptor.Transient <ITarget, LoggerTarget>()); }