Example #1
0
 public RequestEventArgs(Guid id, LogInfo requestLog, LogInfo responseLog)
 {
     _requestLog = requestLog;
     _responseLog = responseLog;
     _id = id;
 }
Example #2
0
        private void PublishLogToCommonLogging(LogInfo item)
        {
            if (!_useLogger)
            {
                return;
            }

            ILog logger = LogManager.GetCurrentClassLogger();

            string bodyAsString = String.Empty;
            try
            {
                bodyAsString = Encoding.UTF8.GetString(item.Body);
            }
                // ReSharper disable EmptyGeneralCatchClause
            catch (Exception)
                // ReSharper restore EmptyGeneralCatchClause
            {
                /* empty bodies should be allowed */
            }

            string type = item.RowType == 0 ? "" : item.RowType == 1 ? "Request" : "Response";
            logger.Debug(type + " | " +
                         item.Created + " | " +
                         item.StatusCode + " | " +
                         item.Url + " | " +
                         item.PathTranslated + " | " +
                         item.Identity + " | " +
                         "\n===>Headers<====\n" + item.Headers +
                         "\n===>Body<=======\n" + bodyAsString
                );
        }
Example #3
0
        private void OnRequestComplete(Guid id, LogInfo requestLog, LogInfo responseLog)
        {
            PublishLogToCommonLogging(requestLog);
            PublishLogToCommonLogging(responseLog);

            EventHandler<RequestEventArgs> complete = RequestComplete;

            if (complete != null)
            {
                complete(this, new RequestEventArgs(id, requestLog, responseLog));
            }
        }
Example #4
0
        private void OnRequestComplete(Guid id, LogInfo requestLog, LogInfo responseLog)
        {
            EventHandler<RequestEventArgs> complete = RequestComplete;

            if (complete != null)
            {
                complete(this, new RequestEventArgs(id, requestLog, responseLog));
            }
        }
Example #5
0
        private void InitializeLogInfo()
        {
            _requestLog = new LogInfo
                {
                    Created = DateTime.Now,
                    ConversationId = Id,
                    RowType = 1,
                    Identity = _server.GetProcessUser(),
                    PhysicalPath = _server.PhysicalPath
                };

            _responseLog = new LogInfo
                {
                    ConversationId = Id,
                    RowType = 2
                };
        }
        public void OnRequestComplete(Guid id, LogInfo requestLog, LogInfo responseLog)
        {
            Trace.WriteLine(requestLog);
            Trace.WriteLine(responseLog);
            

            EventHandler<RequestEventArgs> complete = RequestComplete;


            if (complete != null)
            {
                complete(this, new RequestEventArgs(id, requestLog, responseLog));
            }
        }