aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Logging/ApplicationLogFileParser.cs
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2020-02-03 17:12:30 +0200
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2020-02-03 17:12:30 +0200
commite3b8d3c00491dcca0f2490f23b150e01595a40e2 (patch)
treeadd8eabfa00126dfc9f57d4a32264113647c0826 /Software/Visual_Studio/Tango.Logging/ApplicationLogFileParser.cs
parentc5bf753ea3fcf332d1dac399595be3e73540c348 (diff)
downloadTango-e3b8d3c00491dcca0f2490f23b150e01595a40e2.tar.gz
Tango-e3b8d3c00491dcca0f2490f23b150e01595a40e2.zip
Changed parser of application log file.
LogViewer. Added drag and drop files to window. Start and End time in filter are displayed start and end of open log file.
Diffstat (limited to 'Software/Visual_Studio/Tango.Logging/ApplicationLogFileParser.cs')
-rw-r--r--Software/Visual_Studio/Tango.Logging/ApplicationLogFileParser.cs15
1 files changed, 8 insertions, 7 deletions
diff --git a/Software/Visual_Studio/Tango.Logging/ApplicationLogFileParser.cs b/Software/Visual_Studio/Tango.Logging/ApplicationLogFileParser.cs
index e91734ada..85f82d04e 100644
--- a/Software/Visual_Studio/Tango.Logging/ApplicationLogFileParser.cs
+++ b/Software/Visual_Studio/Tango.Logging/ApplicationLogFileParser.cs
@@ -86,17 +86,18 @@ namespace Tango.Logging
{
DateTime date = DateTime.ParseExact(logs[i].Replace("[", "").Replace("]", ""), "HH:mm:ss.ff", CultureInfo.InvariantCulture);
String rest = logs[i + 1];
-
- var entries = Regex.Split(rest, @"\[(.*?)\]");
+
+ var matches = Regex.Matches(rest, @"(?<=\[)(.*?)(?=\])");
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), entries[1]);
- item.CallerFile = entries[3];
- item.CallerMethodName = entries[5];
- item.CallerLineNumber = int.Parse(entries[7]);
- item.Message = new String(entries[8].Skip(2).ToArray());
+ 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 = rest.Substring(messageStartIndex, rest.Length - messageStartIndex);
logItems.Add(item);
}
catch (Exception ex)