public RequestLogMiddleware(OwinMiddleware next, RequestLogOption requestLogOption)
     : base(next)
 {
     _next = next;
     //第一个参数是固定的,后边还可以添加自定义的其它参数
     _requestLogOption = requestLogOption;
 }
        public void ConfigureRequestLog(IAppBuilder app)
        {
            var requestLogOption = new RequestLogOption();
            requestLogOption.RequestLogProceAction = (data) =>
            {
                var messageInfo = new MessageInfo();
                messageInfo.Message = "请求日志";
                messageInfo.Body = data;
                messageInfo.Action = (messageData) =>
                {
                    var bodyData = messageData.Body as RequestLogData;
                    if (bodyData == null) return;
                    var requestDataLog = Mapper.MapNew<RequestLogData, RequestDataLog>(bodyData);
                    var mongoDbRepository = new MongoDBRepository<RequestDataLog>();
                    mongoDbRepository.Insert(requestDataLog);

                };
                QueueManagement.getInstance().PushData(messageInfo);
                LogManager.getInstance().WriteRequestLog(messageInfo.Message);
            };

            app.UseRequestLog(requestLogOption);
        }
 /// <summary>
 /// 请求日志
 /// </summary>
 /// <param name="builder"></param>
 /// <param name="requestLogOption">请求日志选项</param>
 /// <returns></returns>
 public static IAppBuilder UseRequestLog(this IAppBuilder builder,
     RequestLogOption requestLogOption)
 {
     //USE可以带多个参数,对应中间件构造函数中的第2、3、....参数;
     return builder.Use<RequestLogMiddleware>(requestLogOption);
 }