diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.Logging/ApplicationLogFileParser.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.Logging/ApplicationLogFileParser.cs | 15 |
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) |
