Beispiel #1
0
        /// <summary>
        /// Configures Log for console logging so that all messages above and including
        /// the specified level are output to the console.
        /// </summary>
        /// <param name="minLevel">The minimal logging level.</param>
        public static void ConfigureForConsoleLogging(LogLevel minLevel)
        {
            ConsoleTarget consoleTarget = new ConsoleTarget();

            LoggingConfiguration config = new LoggingConfiguration();
            LoggingRule rule = new LoggingRule("*", minLevel, consoleTarget);
            config.LoggingRules.Add(rule);
            LogManager.Configuration = config;
        }
 /// <summary>
 /// Adds the elements of an array to the end of this LoggingRuleCollection.
 /// </summary>
 /// <param name="items">
 /// The array whose elements are to be added to the end of this LoggingRuleCollection.
 /// </param>
 public virtual void AddRange(LoggingRule[]items)
 {
     foreach (LoggingRule item in items)
     {
         this.List.Add(item);
     }
 }
 /// <summary>
 /// Initializes a new instance of the LoggingRuleCollection class, containing elements
 /// copied from an array.
 /// </summary>
 /// <param name="items">
 /// The array whose elements are to be added to the new LoggingRuleCollection.
 /// </param>
 public LoggingRuleCollection(LoggingRule[]items)
 {
     this.AddRange(items);
 }
 /// <summary>
 /// Removes the first occurrence of a specific LoggingRule from this LoggingRuleCollection.
 /// </summary>
 /// <param name="value">
 /// The LoggingRule value to remove from this LoggingRuleCollection.
 /// </param>
 public virtual void Remove(LoggingRule value)
 {
     this.List.Remove(value);
 }
 /// <summary>
 /// Inserts an element into the LoggingRuleCollection at the specified index
 /// </summary>
 /// <param name="index">
 /// The index at which the LoggingRule is to be inserted.
 /// </param>
 /// <param name="value">
 /// The LoggingRule to insert.
 /// </param>
 public virtual void Insert(int index, LoggingRule value)
 {
     this.List.Insert(index, value);
 }
 /// <summary>
 /// Return the zero-based index of the first occurrence of a specific value
 /// in this LoggingRuleCollection
 /// </summary>
 /// <param name="value">
 /// The LoggingRule value to locate in the LoggingRuleCollection.
 /// </param>
 /// <returns>
 /// The zero-based index of the first occurrence of the _ELEMENT value if found;
 /// -1 otherwise.
 /// </returns>
 public virtual int IndexOf(LoggingRule value)
 {
     return this.List.IndexOf(value);
 }
 /// <summary>
 /// Determines whether a specfic LoggingRule value is in this LoggingRuleCollection.
 /// </summary>
 /// <param name="value">
 /// The LoggingRule value to locate in this LoggingRuleCollection.
 /// </param>
 /// <returns>
 /// true if value is found in this LoggingRuleCollection;
 /// false otherwise.
 /// </returns>
 public virtual bool Contains(LoggingRule value)
 {
     return this.List.Contains(value);
 }
 /// <summary>
 /// Adds an instance of type LoggingRule to the end of this LoggingRuleCollection.
 /// </summary>
 /// <param name="value">
 /// The LoggingRule to be added to the end of this LoggingRuleCollection.
 /// </param>
 public virtual void Add(LoggingRule value)
 {
     this.List.Add(value);
 }
Beispiel #9
0
 /// <summary>
 /// Configures Log for to log to the specified target so that all messages 
 /// above and including the specified level are output.
 /// </summary>
 /// <param name="target">The target to log all messages to.</param>
 /// <param name="minLevel">The minimal logging level.</param>
 public static void ConfigureForTargetLogging(Target target, LogLevel minLevel)
 {
     LoggingConfiguration config = new LoggingConfiguration();
     LoggingRule rule = new LoggingRule("*", minLevel, target);
     config.LoggingRules.Add(rule);
     LogManager.Configuration = config;
 }