예제 #1
0
 private LogMetadata BuildResponseMetadata(LogMetadata logMetadata, HttpResponseMessage response)
 {
     logMetadata.ResponseStatusCode  = response.StatusCode;
     logMetadata.ResponseTimestamp   = DateTime.Now;
     logMetadata.ResponseContentType = response.Content.Headers.ContentType.MediaType;
     return(logMetadata);
 }
예제 #2
0
        private LogMetadata BuildRequestMetadata(HttpRequestMessage request)
        {
            LogMetadata log = new LogMetadata
            {
                RequestMethod    = request.Method.Method,
                RequestTimestamp = DateTime.Now,
                RequestUri       = request.RequestUri.ToString()
            };

            return(log);
        }
예제 #3
0
        private async Task <bool> SendToLog(LogMetadata logMetadata)
        {
            logProcess = new LoggingProcess(_conHelper);

            if (!logMetadata.Result && (logMetadata.Errors.Count > 0 | logMetadata.Errors != null))
            {
                foreach (ErrorMessageObj item in logMetadata.Errors)
                {
                    await logProcess.TransactionLogAdded(logMetadata.RequestUri + " " + logMetadata.RequestMethod + " " + logMetadata.ResponseStatusCode.ToString(),
                                                         item.Code, ProjectNames.Other, ApplicationType.Windows, logMetadata.ResponseTimestamp, item.Message, 1, 1);

                    await logProcess.ApplicationLogAdded(logMetadata.RequestUri + " " + logMetadata.RequestMethod + " " + logMetadata.ResponseStatusCode.ToString(),
                                                         item.Code, ProjectNames.Other, ApplicationType.Windows, logMetadata.ResponseTimestamp, item.Message, 1, 1);
                }
            }
            return(true);
        }