aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Logging/ApplicationLogFileParser.cs
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2020-02-20 11:39:04 +0200
committerShlomo Hecht <shlomo@twine-s.com>2020-02-20 11:39:04 +0200
commit57a828b4d11ab8274053ee035c8de8014ddd4ca1 (patch)
treec88e63b5e9019fe67cc3be451e46fbe57efc4a35 /Software/Visual_Studio/Tango.Logging/ApplicationLogFileParser.cs
parent2d55102532afaccc447c8a28ded8ccb93437683b (diff)
parentd6e2772dd98e6880de14ea12be0ef53bae24f763 (diff)
downloadTango-57a828b4d11ab8274053ee035c8de8014ddd4ca1.tar.gz
Tango-57a828b4d11ab8274053ee035c8de8014ddd4ca1.zip
merge
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)