/// <summary>
        /// This is the base constructor.
        /// </summary>
        /// <param name="context">This is the API context.</param>
        /// <param name="level">This enumeration determines which part of the data should be logged.</param>
        public AspNetCoreBoundaryEvent(HttpContext context, ApiBoundaryLoggingFilterLevel level, Exception logEx)
        {
            Level     = level;
            mContext  = context;
            Direction = ChannelDirection.Incoming;
            Type      = BoundaryEventType.Interface;
            Id        = Guid.NewGuid();
            Ex        = logEx;

            //if ((level & ApiBoundaryLoggingFilterLevel.Exception) > 0)
            //    Ex = context.Exception;

            //var exceptionFeature = context.Features.Get<IExceptionHandlerPathFeature>();

            if ((level & ApiBoundaryLoggingFilterLevel.Request) > 0)
            {
                Request = new ApiHttpRequestWrapper(context);
            }

            if ((level & ApiBoundaryLoggingFilterLevel.Response) > 0)
            {
                Response = new ApiHttpResponseWrapper(context);
            }

            //if ((level & ApiBoundaryLoggingFilterLevel.RequestContent) > 0)
            //    RequestBody = new ApiMimeContent(context.Request.);

            //if ((level & ApiBoundaryLoggingFilterLevel.ResponseContent) > 0)
            //    ResponseBody = new ApiMimeContent(context.Response);
        }
Beispiel #2
0
        /// <summary>
        /// This is the base constructor.
        /// </summary>
        /// <param name="context">This is the API context.</param>
        /// <param name="level">This enumeration determines which part of the data should be logged.</param>
        public ApiBoundaryEvent(HttpActionExecutedContext context, ApiBoundaryLoggingFilterLevel level)
        {
            Level     = level;
            mContext  = context;
            Direction = ChannelDirection.Incoming;
            Type      = BoundaryEventType.Interface;
            Id        = Guid.NewGuid();

            if ((level & ApiBoundaryLoggingFilterLevel.Exception) > 0)
            {
                Ex = context.Exception;
            }

            if ((level & ApiBoundaryLoggingFilterLevel.Request) > 0)
            {
                Request = new ApiHttpRequestWrapper(context);
            }

            if ((level & ApiBoundaryLoggingFilterLevel.Response) > 0)
            {
                Response = new ApiHttpResponseWrapper(context);
            }

            if ((level & ApiBoundaryLoggingFilterLevel.RequestContent) > 0)
            {
                RequestBody = new ApiMimeContent(context.Request.Content);
            }

            if ((level & ApiBoundaryLoggingFilterLevel.ResponseContent) > 0)
            {
                ResponseBody = new ApiMimeContent(context.Response.Content);
            }
        }