Пример #1
0
        /// <summary>
        /// Sets the Debug dropdown to the correct current debug level.  Not dynamic (does not monitor filesystem).
        /// </summary>
        private void UpdateDebuggingMenu(bool fromClick = false)
        {
            var debug        = new AgentDebug();
            var currentLevel = debug.GetLogLevel();

            log.Debug("CurrentLevel - " + currentLevel);
            var debugPanel = this.Controls.Find("DebuggingPanel", true)[0] as Panel;

            foreach (var control in debugPanel.Controls)
            {
                var checkBox = control as CheckBox;
                if (checkBox != null)
                {
                    if (checkBox.Name == currentLevel + "CheckBox")
                    {
                        checkBox.Checked = true;
                    }
                    else
                    {
                        checkBox.Checked = false;
                    }
                }
            }

            if (currentLevel == "nofile" && fromClick)
            {
                Saved.Text      = "The newrelic.config file could not be located.";
                Saved.BackColor = Color.DarkRed;
                Saved.Visible   = true;
                _savedTimer.Start();
            }
        }
Пример #2
0
        /// <summary>
        /// Click event handler for the buttons INSIDE the Debug dropdown.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnDebugLevelClick(object sender, EventArgs e)
        {
            var newDebugLevel = (sender as CheckBox).Text.ToLower();
            var debug         = new AgentDebug();

            debug.SetLogLevel((AgentDebug.LogLevel)Enum.Parse(typeof(AgentDebug.LogLevel), newDebugLevel));
            UpdateDebuggingMenu(true);
        }
 public void SetDebugLevel_SetDebug()
 {
     AgentDebug debug = new AgentDebug();
     AgentDebug.LogLevel infolevel = AgentDebug.LogLevel.info;
     AgentDebug.LogLevel offLevel = AgentDebug.LogLevel.off;
     debug.SetLogLevel(offLevel);
     Assert.AreEqual(offLevel, debug.GetLogLevel());
     debug.SetLogLevel(infolevel);
     Assert.AreNotEqual(offLevel, debug.GetLogLevel());
 }
Пример #4
0
        public void SetDebugLevel_SetDebug()
        {
            AgentDebug debug = new AgentDebug();

            AgentDebug.LogLevel infolevel = AgentDebug.LogLevel.info;
            AgentDebug.LogLevel offLevel  = AgentDebug.LogLevel.off;
            debug.SetLogLevel(offLevel);
            Assert.AreEqual(offLevel, debug.GetLogLevel());
            debug.SetLogLevel(infolevel);
            Assert.AreNotEqual(offLevel, debug.GetLogLevel());
        }
Пример #5
0
        /// <summary>
        /// Sets the Debug dropdown to the correct current debug level.  Not dynamic (does not monitor filesystem).
        /// </summary>
        private void UpdateDebuggingMenu(bool fromClick = false)
        {
            var debug = new AgentDebug();
            var currentLevel = debug.GetLogLevel();
            log.Debug("CurrentLevel - " + currentLevel);
            var debugPanel = this.Controls.Find("DebuggingPanel", true)[0] as Panel;
            foreach (var control in debugPanel.Controls)
            {
                var checkBox = control as CheckBox;
                if (checkBox != null)
                {
                    if (checkBox.Name == currentLevel + "CheckBox")
                    {
                        checkBox.Checked = true;
                    }
                    else
                    {
                        checkBox.Checked = false;
                    }
                }
            }

            if (currentLevel == "nofile" && fromClick)
            {
                Saved.Text = "The newrelic.config file could not be located.";
                Saved.BackColor = Color.DarkRed;
                Saved.Visible = true;
                _savedTimer.Start();
            }
        }
Пример #6
0
 /// <summary>
 /// Click event handler for the buttons INSIDE the Debug dropdown.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void OnDebugLevelClick(object sender, EventArgs e)
 {
     var newDebugLevel = (sender as CheckBox).Text.ToLower();
     var debug = new AgentDebug();
     debug.SetLogLevel((AgentDebug.LogLevel)Enum.Parse(typeof(AgentDebug.LogLevel), newDebugLevel));
     UpdateDebuggingMenu(true);
 }