//-------------------------------------- // Initialization //-------------------------------------- public UCL_LogStackLine(string unityStackFrame) { m_rawData = unityStackFrame; var match = System.Text.RegularExpressions.Regex.Matches(m_rawData, @".*\(at (.*):(\d+)"); if (match.Count > 0) { string name = match[0].Groups[1].Value; int line = Convert.ToInt32(match[0].Groups[2].Value); m_pointer = new UCL_FilePointer(name, line); if (UCL_Settings.Instance.IsScriptIgnored(m_pointer.FileName)) { m_pointer = null; } } }
public static void JumpToSource(UCL_FilePointer pointer) { pointer.Open(); }
//-------------------------------------- // Initialisation //-------------------------------------- public UCL_LogInfo(int id, string logString, int mode, int instanceId) { m_id = id; m_mode = mode; m_instanceID = instanceId; if (HasMode(UCL_LogMode.AssetImportError) || HasMode(UCL_LogMode.Error) || HasMode(UCL_LogMode.GraphCompileError) || HasMode(UCL_LogMode.ScriptCompileError) || HasMode(UCL_LogMode.ScriptingError) || HasMode(UCL_LogMode.StickyError)) { m_logType = LogType.Error; } else if (HasMode(UCL_LogMode.AssetImportWarning) || HasMode(UCL_LogMode.ScriptCompileWarning) || HasMode(UCL_LogMode.ScriptingWarning)) { m_logType = LogType.Warning; } else { m_logType = LogType.Log; } //Parsing stack trase and log message bool stackFound = false; string[] lines = null; if (Application.platform == RuntimePlatform.OSXEditor) { lines = System.Text.RegularExpressions.Regex.Split(logString, System.Environment.NewLine); } else { lines = System.Text.RegularExpressions.Regex.Split(logString, "\n"); } if (logString.Contains("UnityEngine.Debug:")) { foreach (string line in lines) { if (line.Contains("UnityEngine.Debug:")) { stackFound = true; } if (!stackFound) { m_logString += line; } else { AddStackLine(line); } } } else { foreach (string line in lines) { if (!stackFound) { m_logString = line; stackFound = true; } else { AddStackLine(line); } } } //In case this is an error or warning var match = System.Text.RegularExpressions.Regex.Matches(m_logString, @"Assets\/(.*)\((\d+),(\d+)\):"); if (match.Count > 0) { string name = "Assets/" + match[0].Groups[1].Value; int line = System.Convert.ToInt32(match[0].Groups[2].Value); m_pointer = new UCL_FilePointer(name, line); } //if log line has tag if (m_logType == LogType.Log) { match = System.Text.RegularExpressions.Regex.Matches(m_logString, @"\[(.*)\]: "); if (match.Count > 0) { m_tagName = match [0].Groups [1].Value; int subValue = m_tagName.Length + 4; m_logString = m_logString.Substring(subValue, m_logString.Length - subValue); } } if (m_tagName.Equals(string.Empty)) { switch (m_logType) { case LogType.Error: case LogType.Assert: m_tagName = UCL_Settings.ERROR_TAG_NAME; break; case LogType.Warning: m_tagName = UCL_Settings.WARNING_TAG_NAME; break; default: m_tagName = UCL_Settings.MESSAGE_TAG_NAME; break; } } }