public static ILoggerFactory AddQueue(
     this ILoggerFactory factory,
     QueueLoggerOptions settings)
 {
     factory.AddProvider(new QueueLoggerProvider(settings));
     return(factory);
 }
Esempio n. 2
0
 public QueueLoggerProvider(QueueLoggerOptions settings)
 {
     if (settings.Source == null || settings.Source == "Unknown")
     {
         settings.Source = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
     }
     this.settings = settings;
 }
        public static ILoggerFactory AddQueue(this ILoggerFactory factory, Action <QueueLoggerOptions> settings)
        {
            var config = new QueueLoggerOptions()
            {
            };

            settings(config);

            factory.AddProvider(new QueueLoggerProvider(config));
            return(factory);
        }
        public static ILoggingBuilder AddQueue(this ILoggingBuilder builder, QueueLoggerOptions config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            builder.Services.AddSingleton(config);
            builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton <ILoggerProvider, QueueLoggerProvider>());

            return(builder);
        }
        public static ILoggingBuilder AddQueue(this ILoggingBuilder builder, Action <QueueLoggerOptions> settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            var config = new QueueLoggerOptions();

            settings(config);

            return(builder.AddQueue(config));
        }