Exemple #1
0
        /// <inheritdoc />
        public IDisposable BeginScope <TState>(TState state)
        {
            if (state == null)
            {
                throw new ArgumentNullException(nameof(state));
            }

            return(XUnitLogScope.Push(state));
        }
Exemple #2
0
        /// <summary>
        /// Pushes a new value into the scope.
        /// </summary>
        /// <param name="state">The state object for the scope.</param>
        /// <returns>
        /// An <see cref="IDisposable"/> that pops the scope.
        /// </returns>
        internal static IDisposable Push(object state)
        {
            var temp = Current;

            Current = new XUnitLogScope(state)
            {
                Parent = temp,
            };

            return(new DisposableScope());
        }