private void ExecuteToggleLogLevel(object sender, ExecutedRoutedEventArgs e)
        {
            LogLevelItem item = e.Parameter as LogLevelItem;

            if (item != null)
            {
                item.IsEnabled = !item.IsEnabled;
            }
        }
        private void CanToggleLogLevel(object sender, CanExecuteRoutedEventArgs e)
        {
            LogLevelItem item = e.Parameter as LogLevelItem;

            if (item != null && item.IsLocked == false)
            {
                e.CanExecute = true;
            }
            else
            {
                e.CanExecute = false;
            }
        }
Example #3
0
        /// <summary>
        /// Inits the logging node settings.
        /// </summary>
        protected virtual void InitLoggingNodeSettings()
        {
            var logLevels = new LogLevelItem[6];

            logLevels[0] = new LogLevelItem(NLog.LogLevel.Info, false);
            logLevels[1] = new LogLevelItem(NLog.LogLevel.Trace, false);
            logLevels[2] = new LogLevelItem(NLog.LogLevel.Debug, false);
            logLevels[3] = new LogLevelItem(NLog.LogLevel.Warn, false);
            logLevels[4] = new LogLevelItem(NLog.LogLevel.Error, true, true);
            logLevels[5] = new LogLevelItem(NLog.LogLevel.Fatal, true, true);

            foreach (LogLevelItem logLevel in logLevels)
            {
                LogLevelItemLookup.Add(logLevel.Level, logLevel);
            }
        }
        /// <summary>
        /// When log level of the composite component node changes, it also sets log level of all its subgraph components
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="TraceLab.Core.Settings.GlobalLogLevelSettingEventArgs"/> instance containing the event data.</param>
        private void LogLevelEnableChangedEventHandler(object sender, EventArgs args)
        {
            LogLevelItem logLevelItem = (LogLevelItem)sender;

            SetLogLevel(logLevelItem.Level, logLevelItem.IsEnabled);
        }