예제 #1
0
        private void DrawActiveLoggers(UnityLoggerFactory factory)
        {
            this.guiHelper.InspectorSeparator();

            EditorGUILayout.LabelField("Active Loggers");

            if (EditorApplication.isPlaying || EditorApplication.isPaused)
            {
                var currentStyle = style1;

                foreach (var item in factory.LogConfigs)
                {
                    var cfg = item.Value;

                    GUILayout.BeginVertical(currentStyle);

                    //                    EditorGUILayout.LabelField("{0} - {1}".FormatWith(item.Key.Source.SourceType.FullName, item.Key.Source.Name));
                    EditorGUILayout.LabelField(item.Key.Source.FullName);

                    this.DrawLogLevelConfig(cfg);

                    GUILayout.EndVertical();

                    currentStyle = currentStyle == style1 ? style2 : style1;
                }
            }
            else
            {
                GUILayout.Label("Loggers will be listed here when playing");
            }
        }
예제 #2
0
        private void DrawLoggerConfigs(LoggingController controller, UnityLoggerFactory factory)
        {
            this.guiHelper.InspectorSeparator();

            EditorGUILayout.LabelField("Regex Match Log Levels");

            RegexMatchLogLevelConfig toDelete = null;

            foreach (var cfg in controller.regexMatchLogLevels)
            {
                EditorGUILayout.BeginHorizontal();

                if (GUILayout.Button("X"))
                {
                    toDelete = cfg;
                }

                EditorGUILayout.BeginVertical();
                cfg.Regex = EditorGUILayout.TextField("Pattern", cfg.Regex);
                this.DrawLogLevelConfig(cfg);
                EditorGUILayout.EndVertical();

                EditorGUILayout.EndHorizontal();
            }

            if (toDelete != null)
            {
                controller.regexMatchLogLevels.Remove(toDelete);
            }

            if (GUILayout.Button("Add"))
            {
                var cfg = new RegexMatchLogLevelConfig();
                cfg.CopyFrom(UnityLoggerFactory.DefaultConfig);
                controller.regexMatchLogLevels.Add(cfg);
            }
        }