/// <summary> /// Adds the ignore tag. /// </summary> /// <param name="tag">Adds this tag to ignore list.</param> public static void AddIgnoreTag(string _tag) { // Debug console is currently inactive, so ignore this call if (Instance == null) { return; } ConsoleTag _matchedConsoleTag = Instance.GetConsoleTag(_tag); // We dont have a match, it means that we dont have a tag re if (_matchedConsoleTag == null) { ConsoleTag _newConsoleTag = new ConsoleTag(_tag); // Add this to tags list Instance.m_consoleTags.Add(_newConsoleTag); // Use this new tag as matched _matchedConsoleTag = _newConsoleTag; } // Update ignore flag to "ignore" _matchedConsoleTag.Ignore = true; }
private void Log(string _tagName, object _message, eConsoleLogType _logType, UnityEngine.Object _context, int _skipStackFrameCount = 1) { // Do I need to ignore this call if (IgnoreConsoleLog(_tagName)) { return; } // Add additional skip frame _skipStackFrameCount++; int _tagID = GetIndexOfConsoleTag(_tagName); // When we cant find our tag, add a new entry if (_tagID == -1) { m_consoleTags.Add(new ConsoleTag(_tagName)); // And update tag-ID _tagID = m_consoleTags.Count - 1; } ConsoleTag _consoleLogTag = m_consoleTags[_tagID]; // Marked to ignore this log if (_consoleLogTag.Ignore) { return; } int _logID = m_consoleLogsList.Count + 1; ConsoleLog _newConsoleLog = new ConsoleLog(_logID, _tagID, _message.ToString(), _logType, _context, _skipStackFrameCount); #if UNITY_EDITOR // Add this new console to list of logs m_consoleLogsList.Add(_newConsoleLog); // Add it to display list bool _addSuccess = AddToDisplayableLogList(_newConsoleLog); if (_addSuccess) { // Pause unity player on error if (_logType != eConsoleLogType.INFO && _logType != eConsoleLogType.WARNING) { if (m_errorPause) { EditorApplication.isPaused = true; } } } // Set as modified EditorUtility.SetDirty(this); #else NativeBinding.Log(_newConsoleLog); #endif }
/// <summary> /// Removes the ignore tag. /// </summary> /// <param name="tag">Removes this tag from ignore list.</param> public static void RemoveIgnoreTag(string _tag) { // Debug console is currently inactive, so ignore this call if (Instance == null) { return; } // Get console tag ConsoleTag _matchedConsoleTag = Instance.GetConsoleTag(_tag); if (_matchedConsoleTag != null) { // Update ignore flag to "dont ignore" _matchedConsoleTag.Ignore = false; } }
private bool IgnoreConsoleLog(string _tagName) { // Not debug mode, ignore all log messages if (!IsDebugMode) { return(true); } // All untagged logs are grouped under default-tag-name if (string.IsNullOrEmpty(_tagName)) { _tagName = kDefaultTag; } // Check if this tag is marked as "Ignore" ConsoleTag _matchedConsoleTag = GetConsoleTag(_tagName); if (_matchedConsoleTag != null && _matchedConsoleTag.Ignore) { return(true); } return(false); }
private bool AddToDisplayableLogList(ConsoleLog _consoleLog) { // First check if tag for this is active or not int _tagID = _consoleLog.TagID; ConsoleTag _logTag = m_consoleTags[_tagID]; if (!_logTag.IsActive) { return(false); } // Update log message counters if (_consoleLog.Type == eConsoleLogType.INFO) { InfoLogsCounter++; } else if (_consoleLog.Type == eConsoleLogType.WARNING) { WarningLogsCounter++; } else { ErrorLogsCounter++; } // Next we need to check log-type if (((int)_consoleLog.Type & (int)m_allowedLogTypes) == 0) { return(false); } // Now that it passed our configurations, add it to the list m_displayableConsoleLogsList.Add(_consoleLog); return(true); }
private void DrawFilters() { GUILayout.BeginVertical(kBoxStyle, GUILayout.MinWidth(kFiltersWindowMinWidth), GUILayout.Width(m_filtersWindowWidth)); { // Filters tab GUILayout.Label("Filters", kFiltersTitleStyle, GUILayout.Width(m_filtersWindowWidth)); m_filtersScrollPosition = GUILayout.BeginScrollView(m_filtersScrollPosition); { int _consoleTagsCount = 0; if (m_consoleTags != null) { _consoleTagsCount = m_consoleTags.Count; } for (int _iter = 0; _iter < _consoleTagsCount; _iter++) { ConsoleTag _consoleTag = m_consoleTags[_iter]; // Check for change EditorGUI.BeginChangeCheck(); _consoleTag.IsActive = GUILayout.Toggle(_consoleTag.IsActive, _consoleTag.Name, m_filtersGUIStyle); // If state of console tag is modified, then we need to rebuild display list if (EditorGUI.EndChangeCheck()) { RebuildDisplayableLogs(); } } } GUILayout.EndScrollView(); } GUILayout.EndVertical(); }
/// <summary> /// Adds the ignore tag. /// </summary> /// <param name="tag">Adds this tag to ignore list.</param> public static void AddIgnoreTag (string _tag) { // Debug console is currently inactive, so ignore this call if (Instance == null) return; ConsoleTag _matchedConsoleTag = Instance.GetConsoleTag(_tag); // We dont have a match, it means that we dont have a tag re if (_matchedConsoleTag == null) { ConsoleTag _newConsoleTag = new ConsoleTag(_tag); // Add this to tags list Instance.m_consoleTags.Add(_newConsoleTag); // Use this new tag as matched _matchedConsoleTag = _newConsoleTag; } // Update ignore flag to "ignore" _matchedConsoleTag.Ignore = true; }
public static void LogWarning( ConsoleTag tag, string msg ) { Debug.LogWarning ( msg ); }
public static void LogError( ConsoleTag tag, string msg ) { Debug.LogError ( msg ); }
public static void Log( ConsoleTag tag, string msg ) { Debug.Log ( msg ); UnityConsoleEditor.Instance.Log( tag.ToString(), msg ); }