示例#1
0
        /// <summary>
        /// Begins a logical operation scope.
        /// </summary>
        /// <typeparam name="TState"></typeparam>
        /// <param name="state">The identifier for the scope.</param>
        /// <returns>
        /// An IDisposable that ends the logical operation scope on dispose.
        /// </returns>
        public virtual IDisposable BeginScope <TState>(TState state)
        {
            Assumption.AssertTrue(!object.Equals(state, default(TState)), nameof(state));

            var scope = new RollbarScope(_name, state);

            return(RollbarScope.Push(scope));
        }
示例#2
0
        /// <summary>
        /// Pushes the specified scope.
        /// </summary>
        /// <param name="scope">The scope.</param>
        /// <returns>IDisposable.</returns>
        public static IDisposable Push(RollbarScope scope)
        {
            Assumption.AssertNotNull(scope, nameof(scope));

            var temp = Current;

            Current      = scope;
            Current.Next = temp;

            return(new DisposableAction(
                       () => { RollbarScope.Current = RollbarScope.Current.Next; }
                       ));
        }