public static void LogByType(TsLog.ELogType logType, string message, params object[] objs) { if (!TsLog.EnableLogType(logType)) { return; } string text = string.Format(message, objs); switch (logType) { case TsLog.ELogType.Error: Debug.LogError(text); break; case TsLog.ELogType.Assert: case TsLog.ELogType.Exception: TsLog.Instance._assertLog.Add(text); Debug.LogError(text); break; case TsLog.ELogType.Warning: Debug.LogWarning(text); break; case TsLog.ELogType.Log: Debug.Log(text); break; } }
public static TsLog.LogData Create_CompileLog(TsLog.ELogType logType, string compileLog) { TsLog.LogData logData = TsLog.LogData.Create(logType, compileLog, string.Empty); if (logData != null) { try { int num = compileLog.IndexOf('('); int num2 = compileLog.IndexOf(','); string text = compileLog.Substring(0, num); string s = compileLog.Substring(num + 1, num2 - num - 1); int num3; if (!int.TryParse(s, out num3)) { num3 = 0; } TsLog.LogData.FrameInfo frameInfo = new TsLog.LogData.FrameInfo(string.Format("{0} : {1}", text, num3), text, num3); logData.frameInfos.Insert(0, frameInfo); logData.activeFrameInfo = frameInfo; } catch { } } return(logData); }
public static void _InternalOnly_CompileLog(TsLog.ELogType logType, string compileLog) { TsLog.Instance._LogFromUnity(TsLog.LogData.Create_CompileLog(logType, compileLog)); }
public static void EnableLogType(TsLog.ELogType eLogType, bool enable) { TsLog.Instance.s_disable[(int)eLogType] = !enable; }
public static bool EnableLogType(TsLog.ELogType eLogType) { return(!TsLog.Instance.s_disable[(int)eLogType]); }
public static TsLog.LogData Create(TsLog.ELogType logType, string message, string stackTrace) { TsLog.LogData logData = new TsLog.LogData(); try { logData.logType = logType; logData.message = message; } catch (Exception ex) { logData.logType = TsLog.ELogType.Error; logData.message = "param���ڸ� Ȯ�����ּ���~!! exception= " + ex.ToString(); } logData.time = Time.time; logData.frame = Time.frameCount; logData.usedHeapSize = Profiler.usedHeapSize; logData.stackInfos = TsLog.LogData.CreateStackInfo(stackTrace); logData.frameInfos = new List <TsLog.LogData.FrameInfo>(); bool flag = false; StringBuilder stringBuilder = new StringBuilder(128); foreach (TsLog.LogData.StackInfo current in logData.stackInfos) { string text = current.fileName; if (!string.IsNullOrEmpty(text)) { int num = text.IndexOf("Assets"); if (num != -1) { if (logData.activeFrameInfo == null) { flag = true; } } else { num = text.IndexOf("Editor"); } if (num != -1) { text = text.Substring(num); } } stringBuilder.Remove(0, stringBuilder.Length); stringBuilder.AppendFormat("{0}.{1}()", Path.GetFileNameWithoutExtension(text), current.methodName); TsLog.LogData.FrameInfo frameInfo = new TsLog.LogData.FrameInfo(string.Format("{0} [{1}] : {2}", stringBuilder, text, current.lineNum), text, current.lineNum); logData.frameInfos.Add(frameInfo); if (flag) { logData.activeFrameInfo = frameInfo; flag = false; } } if (logData.activeFrameInfo == null) { if (logData.frameInfos.Count <= 0) { logData.activeFrameInfo = TsLog.LogData.DummyFrameInfo; } else { logData.activeFrameInfo = logData.frameInfos[0]; } } return(logData); }