示例#1
0
        public static IList <LogItem> ParseLogFile(string path)
        {
            IEnumerable <LogItem> result = null;

            try
            {
                AbstractEntriesProvider provider = EntriesProviderFactory.GetProvider();
                result = provider.GetEntries(path);
                return(result.ToList());
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.TraceError("Error parsing log file [{0}]:\r\n{1}\r\n{2}", path, ex.Message, ex.StackTrace);
                throw;
            }
        }
示例#2
0
        public static IList <LogItem> ParseLogFile(string path)
        {
            IEnumerable <LogItem> result = null;

            try
            {
                AbstractEntriesProvider provider = EntriesProviderFactory.GetProvider();
                result = provider.GetEntries(path);
                return(result.ToList());
            }
            catch (Exception ex)
            {
                string message = String.Format(Resources.GlobalHelper_ParseLogFile_Error_Text, path, ex.Message);
                MessageBox.Show(message, Resources.GlobalHelper_ParseLogFile_Error_Title, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return(result == null ? new List <LogItem>() : result.ToList());
            }
        }
示例#3
0
        public static IList <LogItem> ParseLogFile(string path)
        {
            IEnumerable <LogItem> result = null;

            try
            {
                AbstractEntriesProvider provider = EntriesProviderFactory.GetProvider(GetProviderTypeFor(new FileInfo(path).Extension));
                result = provider.GetEntries(path, new FilterParams {
                    Pattern = "%date [%thread] %-5level %logger [%property{NDC}] - %message%newline"
                });
                return(result.ToList());
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.TraceError("Error parsing log file [{0}]:\r\n{1}\r\n{2}", path, ex.Message, ex.StackTrace);
                throw;
            }
        }