Пример #1
0
        public static IDisposable Push(TraceScope scope, TraceStore store)
        {
            if (scope == null)
            {
                throw new ArgumentNullException(nameof(scope));
            }

            if (store == null)
            {
                throw new ArgumentNullException(nameof(store));
            }

            //if (scope._name.Equals("Microsoft.AspNetCore.Hosting.Internal.WebHost", StringComparison.OrdinalIgnoreCase))
            //{
            //    return new DisposableAction(() =>
            //    {
            //        //Current.Node.EndTime = DateTimeOffset.UtcNow;
            //        //Current = Current.Parent;
            //    });
            //}

            var temp = Current;

            Current        = scope;
            Current.Parent = temp;

            Current.Node = new ScopeNode()
            {
                StartTime = DateTimeOffset.UtcNow,
                State     = Current._state,
                Name      = Current._name
            };

            if (Current.Parent != null)
            {
                Current.Node.Parent = Current.Parent.Node;
                Current.Parent.Node.Children.Add(Current.Node);
            }
            else
            {
                Current.Context.Root = Current.Node;
                store.AddActivity(Current.Context);
            }

            return(new DisposableAction(() =>
            {
                Current.Node.EndTime = DateTimeOffset.UtcNow;
                Current = Current.Parent;
            }));
        }
        public TraceLoggerProvider(TraceStore store, IOptions <TraceOptions> options)
        {
            if (store == null)
            {
                throw new ArgumentNullException(nameof(store));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            _store   = store;
            _options = options.Value;
        }
Пример #3
0
 public TraceLogger(string name, TraceOptions options, TraceStore store)
 {
     _name    = name;
     _options = options;
     _store   = store;
 }
 public TracePageMiddleware(RequestDelegate next, IOptions <TraceOptions> options, TraceStore store)
 {
     _next    = next;
     _options = options.Value;
     _store   = store;
 }