当前位置: 首页>>代码示例>>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;未经允许,请勿转载。