Example #1
0
        /// <summary>
        /// Pushes the current LogContext, and activates the given LogContext.
        /// </summary>
        /// <param name="newContext">The LogContext to activate.</param>
        /// <returns>A LogContextScope which can be Disposed to reestablish
        /// the previous LogContext.</returns>
        public LogContextScope Push(LogContext newContext)
        {
            var scope = new LogContextScope(this);

            this.CorrelationId             = newContext.CorrelationId;
            this.ExtendedProperties        = newContext.ExtendedProperties;
            this.InheritExtendedProperties = newContext.InheritExtendedProperties;
            return(scope);
        }
Example #2
0
        /// <summary>
        /// Pushes the current LogContext, and returns a
        /// LogContextScope, which - when Disposed - will reestablish the
        /// previous LogContext.
        /// </summary>
        /// <returns>A LogContextScope which can be Disposed to reestablish
        /// the previous LogContext.</returns>
        public LogContextScope Push()
        {
            var scope = new LogContextScope(this);

            return(scope);
        }