public GoogleLoggerScope GetCurrentScope() { var current = _permanentParent; var labels = new Dictionary <string, string>(); if (_serviceProvider?.GetService <IEnumerable <ILogEntryLabelProvider> >() is IEnumerable <ILogEntryLabelProvider> providers) { foreach (var provider in providers) { provider.Invoke(labels); } } _obsoleteLabelsGetter?.Invoke(_serviceProvider, labels); if (labels.Count > 0) { current = GoogleLoggerScope.CreateScope(new LabellingScopeState(labels), current); } return(current); }
internal AmbientScopeManager(LoggingOptions options, IServiceProvider serviceProvider, Action <IServiceProvider, Dictionary <string, string> > obsoleteLabelsGetter) { _permanentParent = options?.Labels is null ? null : GoogleLoggerScope.CreateScope(new LabellingScopeState(options.Labels), null); _serviceProvider = serviceProvider; _obsoleteLabelsGetter = obsoleteLabelsGetter; }