コード例 #1
0
        protected sealed override void SetCustomProperties(Dictionary <string, object> customProperties)
        {
            if (_apiLogVerbosity == ApiLogVerbosity.LogEverything)
            {
                customProperties["request"]  = Request.ToString();
                customProperties["response"] = Response.ToString();
            }
            else if (_apiLogVerbosity == ApiLogVerbosity.LogMinimalRequest)
            {
                customProperties["requestQueryString"] = Request.QueryString;
                customProperties["requestBody"]        = Request.Body;
                customProperties["responseStatusCode"] = Response.StatusCode;
                customProperties["responseBody"]       = Response.Body;
            }

            customProperties["remoteIpAddress"]             = Request.RemoteIpAddress;
            customProperties["requestExecutionTimeMS"]      = RequestExecutionTime;
            customProperties["requestExecutionTimeMinutes"] = RequestExecutionTimeMinutes;

            if (!ActivityId.IsNullOrEmpty())
            {
                customProperties["activityId"] = ActivityId;
            }
            if (!ParentActivityId.IsNullOrEmpty())
            {
                customProperties["parentActivityId"] = ParentActivityId;
            }
            if (!UserId.IsNullOrEmpty())
            {
                customProperties["userId"] = UserId;
            }
            SetDerivedClassCustomProperties(customProperties);
        }