public static void AddLoggerService(this ILoggingBuilder loggingBuilder, Action <LogServiceOptions> logServiceOptionsAction)
        {
            var logOptions = new LogServiceOptions();

            logServiceOptionsAction.Invoke(logOptions);

            loggingBuilder.Services.AddSingleton(logOptions);
            loggingBuilder.Services.AddSingleton <LogOptions>(logOptions);

            loggingBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton <ILogQueue, LogQueue>());
            loggingBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton <ILoggerProvider, QueueLoggerProvider>());
            loggingBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton <ILogServiceClient, LogServiceClient>());

            loggingBuilder.Services.AddScoped <ILogReader, DatabaseLogReader>();
            loggingBuilder.Services.AddScoped <ILogWriter, DatabaseLogWriter>();
            loggingBuilder.Services.AddScoped <LogHandler, LogHandler>();
            loggingBuilder.Services.AddScoped <ILogEnvironmentHandler, LogEnvironmentHandler>();
            loggingBuilder.Services.AddScoped <ILogApplicationHandler, LogApplicationHandler>();
            loggingBuilder.Services.AddScoped <ISourceHandler, SourceHandler>();
        }
Beispiel #2
0
 public DatabaseLogReader(LogServiceOptions options)
 {
     _options = options;
 }
 public DatabaseLogWriter(LogServiceOptions options)
 {
     _options = options;
 }