public LogLevelCounts GetLogLevelCounts()
        {
            //We will need to stop the request if trying to do this on a 1GB file
            if (CanViewLogs() == false)
            {
                throw new HttpResponseException(Request.CreateNotificationValidationErrorResponse("Unable to view logs, due to size"));
            }

            return(_logViewer.GetLogLevelCounts(startDate: DateTime.Now.AddDays(-1), endDate: DateTime.Now));
        }
        public void Logs_Contain_Correct_Log_Level_Counts()
        {
            var logCounts = _logViewer.GetLogLevelCounts(startDate: _startDate, endDate: _endDate);

            Assert.AreEqual(1954, logCounts.Debug);
            Assert.AreEqual(2, logCounts.Error);
            Assert.AreEqual(0, logCounts.Fatal);
            Assert.AreEqual(62, logCounts.Information);
            Assert.AreEqual(7, logCounts.Warning);
        }
        public void Logs_Contain_Correct_Log_Level_Counts()
        {
            LogLevelCounts logCounts = _logViewer.GetLogLevelCounts(_logTimePeriod);

            Assert.AreEqual(55, logCounts.Debug);
            Assert.AreEqual(1, logCounts.Error);
            Assert.AreEqual(0, logCounts.Fatal);
            Assert.AreEqual(38, logCounts.Information);
            Assert.AreEqual(6, logCounts.Warning);
        }
Beispiel #4
0
        public ActionResult <LogLevelCounts> GetLogLevelCounts([FromQuery] DateTime?startDate = null, [FromQuery] DateTime?endDate = null)
        {
            var logTimePeriod = GetTimePeriod(startDate, endDate);

            //We will need to stop the request if trying to do this on a 1GB file
            if (CanViewLogs(logTimePeriod) == false)
            {
                return(ValidationProblem("Unable to view logs, due to size"));
            }

            return(_logViewer.GetLogLevelCounts(logTimePeriod));
        }
Beispiel #5
0
        public LogLevelCounts GetLogLevelCounts([FromUri] DateTime?startDate = null, [FromUri] DateTime?endDate = null)
        {
            var logTimePeriod = GetTimePeriod(startDate, endDate);

            //We will need to stop the request if trying to do this on a 1GB file
            if (CanViewLogs(logTimePeriod) == false)
            {
                throw new HttpResponseException(Request.CreateNotificationValidationErrorResponse("Unable to view logs, due to size"));
            }

            return(_logViewer.GetLogLevelCounts(logTimePeriod));
        }