public static CloseGroupViewModel Get(ILuceneSearcher searcher, Document document)
 {
     return(new CloseGroupViewModel
     {
         LogLevel = document.Get(LogField.LOG_LEVEL),
         LogTime = DateTools.StringToDate(document.Get(LogField.LOG_TIME)).ToString("dd/MM/yyyy HH:mm:ss.fff"),
         Conclusion = document.Get(LogField.CONCLUSION),
         GroupDepth = int.Parse(document.Get(LogField.GROUP_DEPTH)),
         Exception = ExceptionViewModel.Get(searcher, document)
     });
 }
Beispiel #2
0
 public static OpenGroupViewModel Get(ILuceneSearcher luceneSearcher, Document document)
 {
     return(new OpenGroupViewModel
     {
         LogLevel = document.Get(LogField.LOG_LEVEL),
         GroupDepth = int.Parse(document.Get(LogField.GROUP_DEPTH)),
         LogTime = DateTools.StringToDate(document.Get(LogField.LOG_TIME)).ToString("dd/MM/yyyy HH:mm:ss.fff"),
         Text = document.Get(LogField.TEXT),
         SourceFileName = document.Get(LogField.SOURCE_FILE_NAME),
         Exception = ExceptionViewModel.Get(luceneSearcher, document)
     });
 }
Beispiel #3
0
        public static IInnerExceptionViewModel Get(ILuceneSearcher searcher, Document doc)
        {
            if (doc.GetField(LogField.INNER_EXCEPTION) == null)
            {
                return(null);
            }

            var exception = searcher.GetDocument(new TermQuery(new Term(LogField.INDEX_DTS, doc.Get(LogField.INNER_EXCEPTION))), 999);

            return(new InnerExceptionViewModel
            {
                StackTrace = exception.Get(LogField.STACKTRACE),
                Message = exception.Get(LogField.MESSAGE),
                FileName = exception.Get(LogField.SOURCE_FILE_NAME)
            });
        }
        private static IExceptionViewModel GetAggregateException(ILuceneSearcher searcher, string id)
        {
            var exception = searcher.GetDocument(LogField.INDEX_DTS, id, 999);

            if (exception.GetField(LogField.EXCEPTION_TYPE_NAME) == null)
            {
                return(null);
            }

            return(new ExceptionViewModel
            {
                Message = exception.Get(LogField.MESSAGE),
                StackTrace = exception.Get(LogField.STACKTRACE),
                InnerException = InnerExceptionViewModel.Get(searcher, exception),
            });
        }
        public static IExceptionViewModel Get(ILuceneSearcher searcher, Document doc)
        {
            if (doc.GetField(LogField.EXCEPTION) == null)
            {
                return(null);
            }

            var exception = searcher.GetDocument(LogField.INDEX_DTS, doc.Get(LogField.EXCEPTION), 999);

            return(new ExceptionViewModel
            {
                Message = exception.Get(LogField.MESSAGE),
                StackTrace = exception.Get(LogField.STACKTRACE),
                InnerException = InnerExceptionViewModel.Get(searcher, exception),
                AggregatedExceptions = GetAggregatedExceptions(searcher, doc)
            });
        }
Beispiel #6
0
 public static LineViewModel Get(ILuceneSearcher luceneSearcher, Document document)
 {
     return(new LineViewModel
     {
         MonitorId = document.Get(LogField.MONITOR_ID),
         GroupDepth = Int32.Parse(document.Get(LogField.GROUP_DEPTH)),
         PreviousEntryType = document.Get(LogField.PREVIOUS_ENTRY_TYPE),
         PreviousLogTime = DateTools.StringToDate(document.Get(LogField.PREVIOUS_LOG_TIME)).ToString("dd/MM/yyyy HH:mm:ss.fff"),
         LogLevel = document.Get(LogField.LOG_LEVEL),
         Text = document.Get(LogField.TEXT),
         Tags = document.Get(LogField.TAGS),
         SourceFileName = document.Get(LogField.SOURCE_FILE_NAME),
         LineNumber = document.Get(LogField.LINE_NUMBER),
         LogTime = DateTools.StringToDate(document.Get(LogField.LOG_TIME)).ToString("dd/MM/yyyy HH:mm:ss.fff"),
         Exception = ExceptionViewModel.Get(luceneSearcher, document),
         AppName = document.Get(LogField.APP_NAME)
     });
 }
        private static List <IExceptionViewModel> GetAggregatedExceptions(ILuceneSearcher searcher, Document doc)
        {
            var exception = searcher.GetDocument(LogField.INDEX_DTS, doc.Get(LogField.EXCEPTION), 999);

            if (string.IsNullOrEmpty(exception.Get(LogField.AGGREGATED_EXCEPTIONS)))
            {
                return(null);
            }

            var list = new List <IExceptionViewModel>();

            if (exception.Get(LogField.EXCEPTION_TYPE_NAME) != LogField.AGGREGATE_EXCEPTION)
            {
                return(list);
            }

            var ids = exception.Get(LogField.AGGREGATED_EXCEPTIONS).Split(';');

            list.AddRange(from id in ids where !string.IsNullOrEmpty(id) select GetAggregateException(searcher, id));

            return(list);
        }