private void Write(string msg, sw.util.LogLevel level, bool writeEditorLog) { object obj2; Monitor.Enter(obj2 = m_locker); try { if (writeEditorLog) { sw.util.LogLevel level2 = level; if (level2 <= sw.util.LogLevel.ERROR) { switch (level2) { case sw.util.LogLevel.DEBUG: case sw.util.LogLevel.INFO: Debug.Log(msg); break; case (sw.util.LogLevel.INFO | sw.util.LogLevel.DEBUG): break; case sw.util.LogLevel.WARNING: Debug.LogWarning(msg); break; case sw.util.LogLevel.ERROR: Debug.LogError(msg); break; } } if (this.m_sw != null) { this.m_sw.WriteLine(msg); this.m_sw.Flush(); } } } catch (Exception exception) { Debug.LogError(exception.Message); } finally { Monitor.Exit(obj2); } }
public void WriteLog(string msg, sw.util.LogLevel level, bool writeEditorLog) { if (m_logWriter == null) { return; } if (Application.platform == RuntimePlatform.IPhonePlayer) { this.m_logWriter(msg, level, writeEditorLog); } else { this.m_logWriter.BeginInvoke(msg, level, writeEditorLog, null, null); } }
private static void Log(string message, sw.util.LogLevel level, bool writeEditorLog = true) { string msg = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss,fff") + message; m_logWriter.WriteLog(msg, level, writeEditorLog); if (OnLog != null) { OnLog(msg, level); } if (testDebugLog != null)//测试脚本记录错误日志 { testDebugLog(msg, level); } //UnityEngine.Debug.Log(message); //Messenger.Broadcast<string>(CommonEvent.SHOW_STATUS, message); }
private static void ProcessExceptionReport(string message, string stackTrace, LogType type) { sw.util.LogLevel dEBUG = sw.util.LogLevel.DEBUG; switch (type) { case LogType.Error: dEBUG = sw.util.LogLevel.ERROR; break; case LogType.Assert: dEBUG = sw.util.LogLevel.DEBUG; break; case LogType.Warning: dEBUG = sw.util.LogLevel.WARNING; break; case LogType.Log: dEBUG = sw.util.LogLevel.DEBUG; return; break; case LogType.Exception: dEBUG = sw.util.LogLevel.EXCEPT; break; } if (dEBUG == (CurrentLogLevels & dEBUG)) { string msg = string.Concat(new object[] { " [SYS_", dEBUG, "]: ", message, '\n', stackTrace }); Log(msg, dEBUG, false); if (postErrors != null && dEBUG == LogLevel.ERROR || dEBUG == LogLevel.EXCEPT) { lock (postErrors) { postErrors.Enqueue(msg); } } } }