Example #1
0
        public void Log(RequestLog log)
        {
            if (log == null)
                throw new ArgumentException("Log value is invalid");

            try
            {
                _repository.Save(log, TimeSpan.FromHours(25));
            }
            catch (Exception ex)
            {
                throw HandleException(new object[] { log.Id }, ex);
            }
        }
        public static void LogAsync(RequestLog log)
        {
            Task.Factory.StartNew((u) =>
            {
                try
                {
                    RequestLogService logService = new RequestLogService();
                    if (log != null)
                    {
                        logService.Log(log);
                    }
                }
                catch
                {

                }
            },
                log);
        }
Example #3
0
 /// <summary>
 /// Gets the request log.
 /// </summary>
 /// <returns></returns>
 public RequestLog GetRequestLog()
 {
     RequestLog log = new RequestLog();
     log.Id = Guid.NewGuid().ToString();
     log.DT = DateTime.UtcNow;
     var request = System.Web.HttpContext.Current.Request;
     if (request.UrlReferrer != null)
         log.Referrer = request.UrlReferrer.ToString();
     log.RemoteIP = request.ClientIPFromRequest(false);
     log.Raw = request.ToRaw();
     log.RequestUrl = request.RawUrl;
     return log;
 }