Exemplo n.º 1
0
        public IDisposable ParseBeginScope <T>(T state)
        {
            if (_options.CaptureMessageProperties)
            {
                if (state is IList <KeyValuePair <string, object> > scopePropertyList)
                {
                    return(ScopeProperties.CaptureScopeProperties(scopePropertyList));
                }

                if (!(state is string))
                {
                    if (state is System.Collections.IEnumerable scopePropertyCollection)
                    {
                        return(ScopeProperties.CaptureScopeProperties(scopePropertyCollection, _scopeStateExtractors));
                    }
                    else
                    {
                        return(ScopeProperties.CaptureScopeProperty(state, _scopeStateExtractors));
                    }
                }
                else
                {
                    return(NestedDiagnosticsLogicalContext.Push(state));
                }
            }

            return(CreateDiagnosticLogicalContext(state));
        }
        public IDisposable ParseBeginScope <T>(T state)
        {
            if (_options.CaptureMessageProperties)
            {
                if (state is IReadOnlyList <KeyValuePair <string, object> > scopePropertyList)
                {
                    return(ScopeProperties.CaptureScopeProperties(scopePropertyList, _options.IncludeActivtyIdsWithBeginScope));
                }

                if (!(state is string))
                {
                    if (state is IEnumerable scopePropertyCollection)
                    {
                        return(ScopeProperties.CaptureScopeProperties(scopePropertyCollection, _scopeStateExtractors));
                    }

                    return(ScopeProperties.CaptureScopeProperty(state, _scopeStateExtractors));
                }
            }

            return(NestedDiagnosticsLogicalContext.Push(state));
        }