private void Awake() { TempLogManager.InitLogManager(); m_logButton.onClick.AddListener(DoLog); m_logWarningButton.onClick.AddListener(DoLogWarning); m_logErrorButton.onClick.AddListener(DoLogError); Application.logMessageReceivedThreaded += ShowLogText; }
private void DoLogError() { m_logString = m_inpuField.text; if (string.IsNullOrEmpty(m_logString) || string.IsNullOrWhiteSpace(m_logString)) { return; } else { TempLogManager.LogError(m_logString); } }
private void DrawMenuUpperBar() { m_menuUpperBar = new Rect(0.0f, 0.0f, this.position.width, MENU_BAR_HEIGHT); // draw upper bar, for default console stuff GUILayout.BeginArea(m_menuUpperBar, EditorStyles.toolbar); GUILayout.BeginHorizontal(); if (GUILayout.Button(new GUIContent("Clear"), EditorStyles.toolbarButton, GUILayout.Width(40.0f))) { ClearLogs(); } GUILayout.Space(5.0f); m_isClearOnPlay = GUILayout.Toggle(TempLogManagerForUnityEditor.IsClearOnPlay, new GUIContent("Clear On Play"), EditorStyles.toolbarButton, GUILayout.Width(80.0f)); TempLogManagerForUnityEditor.IsClearOnPlay = m_isClearOnPlay; // m_isErrorPause = GUILayout.Toggle(LogManagerForUnityEditor.IsErrorPause, new GUIContent("Error Pause"), EditorStyles.toolbarButton, GUILayout.Width(70.0f)); // LogManagerForUnityEditor.IsErrorPause = m_isErrorPause; m_writeFileInEditorMode = GUILayout.Toggle(m_writeFileInEditorMode, new GUIContent("Write Log File"), EditorStyles.toolbarButton, GUILayout.Width(120.0f)); TempLogManagerForUnityEditor.SetWriteFileFlag(m_writeFileInEditorMode); GUILayout.Space(30.0f); if (GUILayout.Button(new GUIContent("Clear Log File"), EditorStyles.toolbarButton, GUILayout.Width(120.0f))) { TempLogManager.ClearLogFiles(); } GUILayout.FlexibleSpace(); m_normalLogCount = Mathf.Clamp(TempLogManagerForUnityEditor.InfoLogCount, 0, 100); m_warningLogCount = Mathf.Clamp(TempLogManagerForUnityEditor.WarningLogCount, 0, 100); m_errorLogCount = Mathf.Clamp(TempLogManagerForUnityEditor.ErrorLogCount, 0, 100); m_isShowLog = GUILayout.Toggle(TempLogManagerForUnityEditor.IsShowLog, new GUIContent(TempLogManagerHelper.GetNumberStr(m_normalLogCount), m_infoIconSmall), EditorStyles.toolbarButton, GUILayout.Width(LOG_FLAG_SIZE)); m_isShowWarning = GUILayout.Toggle(TempLogManagerForUnityEditor.IsShowWarning, new GUIContent(TempLogManagerHelper.GetNumberStr(m_warningLogCount), m_warningIconSmall), EditorStyles.toolbarButton, GUILayout.Width(LOG_FLAG_SIZE)); m_isShowError = GUILayout.Toggle(TempLogManagerForUnityEditor.IsShowError, new GUIContent(TempLogManagerHelper.GetNumberStr(m_errorLogCount), m_errorIconSmall), EditorStyles.toolbarButton, GUILayout.Width(LOG_FLAG_SIZE)); TempLogManagerForUnityEditor.IsShowLog = m_isShowLog; TempLogManagerForUnityEditor.IsShowWarning = m_isShowWarning; TempLogManagerForUnityEditor.IsShowError = m_isShowError; int prevCount = m_logTypeForUnshow.Count; m_logTypeForUnshow.Clear(); if (!m_isShowLog) { m_logTypeForUnshow.Add(LogType.Log); } if (!m_isShowWarning) { m_logTypeForUnshow.Add(LogType.Warning); } if (!m_isShowError) { m_logTypeForUnshow.Add(LogType.Error); m_logTypeForUnshow.Add(LogType.Assert); m_logTypeForUnshow.Add(LogType.Exception); } m_needRefresh = m_needRefresh || (prevCount != m_logTypeForUnshow.Count); GUILayout.EndHorizontal(); GUILayout.EndArea(); }