當前位置: 首頁>>代碼示例>>C#>>正文


C# LoggingRule.DisableLoggingForLevel方法代碼示例

本文整理匯總了C#中NLog.Config.LoggingRule.DisableLoggingForLevel方法的典型用法代碼示例。如果您正苦於以下問題:C# LoggingRule.DisableLoggingForLevel方法的具體用法?C# LoggingRule.DisableLoggingForLevel怎麽用?C# LoggingRule.DisableLoggingForLevel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NLog.Config.LoggingRule的用法示例。


在下文中一共展示了LoggingRule.DisableLoggingForLevel方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ConfigureLogger

 private void ConfigureLogger(NLog.LogLevel nlogLogLevel)
 {
     var config = new LoggingConfiguration();
     _target = new MemoryTarget {Layout = "${level:uppercase=true}|${message}|${exception}"};
     config.AddTarget("memory", _target);
     var loggingRule = new LoggingRule("*", NLog.LogLevel.Trace, _target);
     loggingRule.DisableLoggingForLevel(nlogLogLevel);
     config.LoggingRules.Add(loggingRule);
     LogManager.Configuration = config;
     _sut = new NLogLogProvider().GetLogger("Test");
 }
開發者ID:bartelink,項目名稱:LibLog,代碼行數:11,代碼來源:NLogLogProviderLoggingDisabedTests.cs

示例2: ConfigureLogger

 private void ConfigureLogger(NLog.LogLevel nlogLogLevel)
 {
     NLogLogManager.ProviderIsAvailableOverride = true;
     var config = new LoggingConfiguration();
     target = new MemoryTarget();
     target.Layout = "${level:uppercase=true}|${message}|${exception}";
     config.AddTarget("memory", target);
     var loggingRule = new LoggingRule("*", LogLevel.Trace, target);
     loggingRule.DisableLoggingForLevel(nlogLogLevel);
     config.LoggingRules.Add(loggingRule);
     NLog.LogManager.Configuration = config;
     sut = new NLogLogManager().GetLogger("Test");
 }
開發者ID:j2jensen,項目名稱:ravendb,代碼行數:13,代碼來源:NLogLogManagerLoggingDisabedTests.cs

示例3: ChangeRuleMinLevel

 private static void ChangeRuleMinLevel(LoggingRule rule, LogLevel minLevel)
 {
     /*
      * Based on how the LoggingLevel initializes its logging levels when given a minLevel,
      * but because LogLevel.MinLevel and LogLevel.MaxLevel are not publically accessible,
      * their current values are hardcoded. TODO: This is fragile!
      */
     for (var i = LogLevel.Trace.Ordinal; i < minLevel.Ordinal; i++)
     {
         rule.DisableLoggingForLevel(LogLevel.FromOrdinal(i));
     }
     for (var i = minLevel.Ordinal; i <= LogLevel.Fatal.Ordinal; i++)
     {
         rule.EnableLoggingForLevel(LogLevel.FromOrdinal(i));
     }
     LogManager.ReconfigExistingLoggers();
 }
開發者ID:xor-freenet,項目名稱:wintray,代碼行數:17,代碼來源:PreferencesWindow.cs

示例4: SetLogLevelForRule

        private void SetLogLevelForRule(LoggingRule rule, LogLevel activeLogLevel)
        {
            // Reset all log levels to off
            for (int i = MinLogLevel; i <= MaxLogLevel; i++)
            {
                rule.DisableLoggingForLevel(LogLevel.FromOrdinal(i));
            }

            // Enable the active log level and all levels numerically higher
            for (int i = activeLogLevel.GetHashCode(); i <= MaxLogLevel; i++)
            {
                rule.EnableLoggingForLevel(LogLevel.FromOrdinal(i));
            }

            InternalLogger.Debug("*** Setting active log level for " + _logger.Name + " to " + activeLogLevel.Name);
        }
開發者ID:BogamSushil,項目名稱:OnlineGrocery,代碼行數:16,代碼來源:NLogLogWriter.cs

示例5: ApplyLogLevel

        private void ApplyLogLevel(LoggingRule rule, IList<LogLevel> levels)
        {
            foreach (var level in rule.Levels)
                rule.DisableLoggingForLevel(level);

            foreach (var level in levels)
                rule.EnableLoggingForLevel(level);
        }
開發者ID:juankakode,項目名稱:Drone,代碼行數:8,代碼來源:DroneApp.cs


注:本文中的NLog.Config.LoggingRule.DisableLoggingForLevel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。