Example #1
0
        public AdjustableLogLevelLoggerProvider(IList <ILoggerProvider> innerProviders, ILoggingLevelSwitch logLevelSwitch, bool ownsInnerProviders = false)
        {
            _innerProviders     = innerProviders;
            _ownsInnerProviders = ownsInnerProviders;

            if (ownsInnerProviders)
            {
                var disposables = new IDisposable[_innerProviders.Count];
                for (int i = 0; i < _innerProviders.Count; i++)
                {
                    var provider = _innerProviders[i];
                    if (provider is IDisposable)
                    {
                        disposables[i] = (IDisposable)provider;
                    }
                    else
                    {
                        disposables[i] = null;
                    }
                }

                _innerProvidersDisposable = new CompositeDisposable(disposables);
            }

            LogLevelSwitch = logLevelSwitch;
        }
 public AdjustableLoggerProviderBuilder(ILoggingBuilder builder, ILoggingLevelSwitch loggingLevelSwitch, bool ownsInnerProviders = false)
 {
     _builder            = builder;
     _loggingLevelSwitch = loggingLevelSwitch;
     OwnsInnerProviders  = ownsInnerProviders;
 }
 public AdjustableLogLevelLogger(ILoggingLevelSwitch logLevelSwitch, ILogger[] innerLoggers)
 {
     _logLevelSwitch = logLevelSwitch;
     _innerLoggers   = innerLoggers;
 }