Ejemplo n.º 1
0
            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);
            }
Ejemplo n.º 2
0
 /// <inheritdoc />
 public IDisposable BeginScope <TState>(TState state) => GoogleLoggerScope.BeginScope(state);
Ejemplo n.º 3
0
 public LabellingScope(LabellingScopeState state, GoogleLoggerScope parent)
     : base(state, parent)
 {
 }
Ejemplo n.º 4
0
 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;
 }