aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities/Tango.LogViewer.UI/LogViewerFileParser/ApplicationLogViewerParser.cs
diff options
context:
space:
mode:
authorMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
committerMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
commit00a491d93733d4625ad329b2ba8237f445364b3f (patch)
tree4b24c6fa78d7648f4bb7cefafa464bb0b063fec4 /Software/Visual_Studio/Utilities/Tango.LogViewer.UI/LogViewerFileParser/ApplicationLogViewerParser.cs
parent124ad4150f80c6846fdee41dbbda9848c105f6e5 (diff)
downloadTango-00a491d93733d4625ad329b2ba8237f445364b3f.tar.gz
Tango-00a491d93733d4625ad329b2ba8237f445364b3f.zip
merge
Diffstat (limited to 'Software/Visual_Studio/Utilities/Tango.LogViewer.UI/LogViewerFileParser/ApplicationLogViewerParser.cs')
-rw-r--r--Software/Visual_Studio/Utilities/Tango.LogViewer.UI/LogViewerFileParser/ApplicationLogViewerParser.cs55
1 files changed, 0 insertions, 55 deletions
diff --git a/Software/Visual_Studio/Utilities/Tango.LogViewer.UI/LogViewerFileParser/ApplicationLogViewerParser.cs b/Software/Visual_Studio/Utilities/Tango.LogViewer.UI/LogViewerFileParser/ApplicationLogViewerParser.cs
deleted file mode 100644
index 1a43a7eff..000000000
--- a/Software/Visual_Studio/Utilities/Tango.LogViewer.UI/LogViewerFileParser/ApplicationLogViewerParser.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Tango.Logging;
-using System.Text.RegularExpressions;
-using System.IO;
-using System.Globalization;
-
-namespace Tango.LogViewer.UI.LogViewerFileParser
-{
- public class ApplicationLogViewerParser : ILogViewerParser
- {
- public ApplicationLogViewerParser()
- {
-
- }
- public void Parse(string file, DateTime datetime, ref List<LogItemBase> logItems)
- {
- String text = File.ReadAllText(file);
- var logs = Regex.Split(text, @"(\[\d{2}:\d{2}:\d{2}.\d{2}\])");
-
- String logText = String.Empty;
-
- for (int i = 1; i < logs.Length; i += 2)
- {
- try
- {
- DateTime date = DateTime.ParseExact(logs[i].Replace("[", "").Replace("]", ""), "HH:mm:ss.ff", CultureInfo.InvariantCulture);
-
- logText = logs[i + 1];
- var matches = Regex.Matches(logText, @"(?<=\[)(.*?)(?=\])");
-
- MessageLogItem item = new MessageLogItem();
- item.TimeStamp = new DateTime(datetime.Year, datetime.Month, datetime.Day, date.Hour, date.Minute, date.Second, date.Millisecond);
- item.Category = (LogCategory)Enum.Parse(typeof(LogCategory), matches[0].ToString());
- item.CallerFile = matches[1].ToString();
- item.CallerMethodName = matches[2].ToString();
- item.CallerLineNumber = int.Parse(matches[3].ToString());
-
- int messageStartIndex = matches[3].Index + matches[3].Length + 2;
-
- item.Message = logText.Substring(messageStartIndex, logText.Length - messageStartIndex);
-
- logItems.Add(item);
- }
- catch (Exception ex)
- {
- LogManager.Default.Log(ex, "Could not parse log line: " + logText);
- }
- }
- }
- }
-}