public void GetLogsTest()
 {
     var target = new LoggingDataProvider();
     int totalRowCount;
     List<Log> actual = target.GetLogs(null, null, null, null, null, null, null, 0, null, null, null, null, 1, 10,
                                       out totalRowCount);
     Assert.IsNotNull(actual);
 }
 public void GetRequestResponseTest()
 {
     var target = new LoggingDataProvider();
     int totalRowCount;
     List<Log> actual = target.GetLogs(null, null, null, null, null, null, null, 0, null, null, null, null, 1, 10,
                                       out totalRowCount);
     Assert.IsNotNull(actual);
     if (actual.Count > 0)
     {
         target.GetRequestByLogId(actual[0].LogId);
         target.GetResponseByLogId(actual[0].LogId);
     }
 }
Пример #3
0
 public static void LogException(Exception exception, string source, string method, Severity severity)
 {
     var log = new ExceptionLog(exception, source, method, severity);
     log.SessionId = ApplicationContext.GetSessionId();
     var dataProvider = new LoggingDataProvider();
     if (LoggingConfigurations.IsLogAsyncEnabled)
     {
         Task.Factory.StartNew(() => new LoggingDataProvider().SaveException(log));
     }
     else
     {
         new LoggingDataProvider().SaveException(log);
     }
 }
Пример #4
0
        public static void LogMessage(Log log)
        {
            if (LoggingConfigurations.IsLoggingEnabled)
            {
                log.SessionId = ApplicationContext.GetSessionId();
                var dataProvider = new LoggingDataProvider();

                if (LoggingConfigurations.IsLogAsyncEnabled)
                {
                    Task.Factory.StartNew(() => new LoggingDataProvider().SaveLog(log));
                }
                else
                {
                    new LoggingDataProvider().SaveLog(log);
                }
            }
        }
Пример #5
0
        public string GetLogs(int? id, DateTime? timestampFrom, DateTime? timestampTo, string machineName,
                              string sessionId, string serviceName, string title, float timeTaken, string status,
                              float? timeMin, float? timeMax, string searchText, int pageIndex, int pageSize,
                              out int totalRowCount)
        {
            pageIndex = pageIndex < 0 ? 1 : pageIndex;
            pageSize = pageSize < 0 ? 10 : pageSize;
            List<Log> lst = new LoggingDataProvider().GetLogs(id, timestampFrom, timestampTo, machineName, sessionId,
                                                              serviceName, title, timeTaken, status, timeMin, timeMax,
                                                              searchText, pageIndex, pageSize, out totalRowCount);

            var flexigridObject = new FlexigridObject
                                      {
                                          page = pageIndex,
                                          total = totalRowCount,
                                          cellNames = new List<string>
                                                          {
                                                              "LogID",
                                                              "SessionId",
                                                              "Timestamp",
                                                              "MachineName",
                                                              "ServiceName",
                                                              "Title",
                                                              "Status",
                                                              "TimeTaken",
                                                              "Request",
                                                              "Response"
                                                          }
                                      };
            foreach (Log x in lst)
            {
                var cell = new FlexigridRow
                               {
                                   id = x.LogId.ToString(),
                                   cell = new List<string>
                                              {
                                                  x.LogId.ToString(),
                                                  x.SessionId,
                                                  x.TimeStamp.ToString(),
                                                  x.MachineName,
                                                  x.ServiceName,
                                                  x.Name,
                                                  x.Status.ToString(),
                                                  x.TimeTaken.ToString(),
                                                  "Click Here",
                                                  "Click Here"
                                              }
                               };

                flexigridObject.rows.Add(cell);
            }

            return Serializer.JSON.Serialize(flexigridObject);
        }
Пример #6
0
        public string GetExceptions(int? exceptionId, string machineName, string source, string targetSite,
                                    string exceptionType, string appDomainName, string message, DateTime? timestampFrom,
                                    DateTime? timestampTo, int pageIndex, int pageSize, string searchText,
                                    string sessionId, out int totalRowCount)
        {
            pageIndex = pageIndex < 0 ? 1 : pageIndex;
            pageSize = pageSize < 0 ? 10 : pageSize;

            List<ExceptionLog> lst = new LoggingDataProvider().GetExceptions(exceptionId, machineName, source,
                                                                             targetSite,
                                                                             exceptionType,
                                                                             appDomainName, message, timestampFrom,
                                                                             timestampTo,
                                                                             pageIndex,
                                                                             pageSize, searchText, sessionId,
                                                                             out totalRowCount);
            var flexigridObject = new FlexigridObject
                                      {
                                          page = pageIndex,
                                          total = totalRowCount,
                                          cellNames = new List<string>
                                                          {
                                                              "Id",
                                                              "SessionId",
                                                              "Title",
                                                              "Severity",
                                                              "Timestamp",
                                                              "MachineName",
                                                              "ExceptionType",
                                                              "Message",
                                                              "Source",
                                                              "AppDomainName",
                                                              "TargetSite",
                                                              "StackTrace",
                                                              "AdditionalInfo",
                                                              "InnerExceptions"
                                                          }
                                      };

            foreach (ExceptionLog x in lst)
            {
                var cell = new FlexigridRow
                               {
                                   id = x.ExceptionId.ToString(),
                                   cell = new List<string>
                                              {
                                                  x.ExceptionId.ToString(),
                                                  x.SessionId,
                                                  x.Title,
                                                  x.Severity,
                                                  x.TimeStamp.ToString(),
                                                  x.MachineName,
                                                  x.Type,
                                                  x.Message,
                                                  x.Source,
                                                  x.AppDomainName,
                                                  x.TargetSite,
                                                  x.StackTrace,
                                                  x.AdditionalInfo,
                                                  x.InnerException
                                              },
                               };

                flexigridObject.rows.Add(cell);
            }

            return Serializer.JSON.Serialize(flexigridObject);
        }
 public void SaveExceptionTest()
 {
     var target = new LoggingDataProvider();
     var exception = new ExceptionLog(new ArgumentException("Test Exception"), "Test", "TestMethod",
                                      Severity.Major, "Test Title");
     target.SaveException(exception);
 }
 public void LoggingDataProviderConstructorTest()
 {
     var target = new LoggingDataProvider();
 }
 public void SaveLogTest()
 {
     var target = new LoggingDataProvider();
     var log = new Log("Test log", "test", "test", 1);
     target.SaveLog(log);
 }