Esempio n. 1
0
        private Dictionary <string, object> CreateContextScope(RequestValues requestValues)
        {
            var mappedRequestValues     = MapAndFilterContextValues(requestValues);
            var namespacedRequestValues = NamespaceValues(mappedRequestValues, _settings.RequestFieldsNamespace);
            var contextScope            = NamespaceValues(namespacedRequestValues, _settings.AllFieldsNamespace);

            return(contextScope);
        }
Esempio n. 2
0
        private Dictionary <string, object> MapAndFilterResponseValues(RequestValues requestValues)
        {
            var values = _settings.ResponseLogFields.Request.GetType().GetProperties()
                         .Where(p => (bool)p.GetValue(_settings.ResponseLogFields.Request, null))
                         .ToDictionary(
                p => PrefixRequestField(p.Name),
                p => requestValues.GetType().GetProperty(p.Name)?.GetValue(requestValues, null)
                );

            return(values);
        }
Esempio n. 3
0
        private Dictionary <string, object> CreateResponseLogScope(
            RequestValues requestValues,
            ResponseValues responseValues)
        {
            var mappedRequestValues     = MapAndFilterResponseValues(requestValues);
            var namespacedRequestValues = NamespaceValues(mappedRequestValues, _settings.RequestFieldsNamespace);

            var mappedResponseValues     = MapAndFilterResponseValues(responseValues);
            var namespacedResponseValues = NamespaceValues(mappedResponseValues, _settings.ResponseFieldsNamespace);

            var mergedValues = namespacedRequestValues
                               .Union(namespacedResponseValues)
                               .ToDictionary(x => x.Key, x => x.Value);
            var responseLogScope = NamespaceValues(mergedValues, _settings.AllFieldsNamespace);

            return(responseLogScope);
        }