private LogEntry ParseLogEntry(Match m) { DateTime dateTime; var dateValue = m.Groups["date"].Value; if (LogPrintFormat == kThreadTime) { dateValue = "1999-" + dateValue; } try { dateTime = DateTime.Parse(dateValue); } catch (Exception ex) { dateTime = new DateTime(); AndroidLogcatInternalLog.Log("Failed to parse date: " + dateValue + "\n" + ex.Message); } var entry = new LogEntry( dateTime, Int32.Parse(m.Groups["pid"].Value), Int32.Parse(m.Groups["tid"].Value), PriorityStringToEnum(m.Groups["priority"].Value), m.Groups["tag"].Value, m.Groups["msg"].Value); if ((entry.priority == Priority.Info && entry.tag.GetHashCode() == kUnityHashCode && entry.message.StartsWith("Built from")) || (entry.priority == Priority.Error && entry.tag.GetHashCode() == kCrashHashCode && entry.message.StartsWith("Build type"))) { m_BuildInfos[entry.processId] = AndroidLogcatUtilities.ParseBuildInfo(entry.message); } if (entry.priority == Priority.Fatal && entry.tag.GetHashCode() == kDebugHashCode && entry.message.StartsWith("pid:")) { // Crash reported by Android for some pid, need to update buildInfo information for this new pid as well ParseCrashBuildInfo(entry.processId, entry.message); } return(entry); }
private LogEntry ParseLogEntry(Match m) { DateTime dateTime; switch (LogPrintFormat) { case kThreadTime: dateTime = DateTime.Parse("1999-" + m.Groups["date"].Value); break; case kYearTime: dateTime = DateTime.Parse(m.Groups["date"].Value); break; default: throw new NotImplementedException("Please implement date parsing for log format: " + LogPrintFormat); } var entry = new LogEntry( dateTime, Int32.Parse(m.Groups["pid"].Value), Int32.Parse(m.Groups["tid"].Value), PriorityStringToEnum(m.Groups["priority"].Value), m.Groups["tag"].Value, m.Groups["msg"].Value); if ((entry.priority == Priority.Info && entry.tag.GetHashCode() == kUnityHashCode && entry.message.StartsWith("Built from")) || (entry.priority == Priority.Error && entry.tag.GetHashCode() == kCrashHashCode && entry.message.StartsWith("Build type"))) { m_BuildInfos[entry.processId] = AndroidLogcatUtilities.ParseBuildInfo(entry.message); } if (entry.priority == Priority.Fatal && entry.tag.GetHashCode() == kDebugHashCode && entry.message.StartsWith("pid:")) { // Crash reported by Android for some pid, need to update buildInfo information for this new pid as well ParseCrashBuildInfo(entry.processId, entry.message); } return(entry); }