Esempio n. 1
0
        /// <summary>
        ///     Sets rule level.
        /// </summary>
        /// <param name="applicationName">
        ///     Name of the application.
        /// </param>
        /// <param name="ruleName">
        ///     Name of the rule.
        /// </param>
        /// <param name="logLevel">
        ///     The log level.
        /// </param>
        /// <param name="enable">
        ///     true to enable, false to disable.
        /// </param>
        public static void SetRuleLevel(
            string applicationName,
            string ruleName,
            LogLevel logLevel,
            bool enable)
        {
            settingsHelperLogger.Debug("Entered static method.");

            if (!InstanceList.ContainsKey(applicationName))
            {
                settingsHelperLogger.Info("Configuration instance {0} does not exist.",
                                          applicationName);
                return;
            }

            LoggingRule loggingRule = InstanceList[applicationName].Rules[ruleName];

            if (enable)
            {
                loggingRule.EnableLoggingForLevel(logLevel);
            }
            else
            {
                loggingRule.DisableLoggingForLevel(logLevel);
            }
        }