Esempio n. 1
0
 private void AddProviderRegistration(ILoggerProvider provider, bool dispose)
 {
     _providerRegistrations.Add(new ProviderRegistration
     {
         Provider      = provider,
         ShouldDispose = dispose
     });
     // 如果日志提供器 实现 ISupportExternalScope 接口
     if (provider is ISupportExternalScope supportsExternalScope)
     {
         if (_scopeProvider == null)
         {
             _scopeProvider = new LoggerExternalScopeProvider();
         }
         //将同一个LoggerExternalScopeProvider实例 保存到 provider._loggers里面
         supportsExternalScope.SetScopeProvider(_scopeProvider);
     }
 }
Esempio n. 2
0
 internal Scope(LoggerExternalScopeProvider provider, object state, Scope parent)
 {
     _provider = provider;
     State     = state;
     Parent    = parent;
 }