Author: nicko
Date: Sun Oct 30 17:12:53 2005
New Revision: 329690
URL: http://svn.apache.org/viewcvs?rev=329690&view=rev
Log:
LOG4NET-53 Allow repository properties to be set in the config file
Modified:
logging/log4net/trunk/src/Repository/Hierarchy/Hierarchy.cs
Modified: logging/log4net/trunk/src/Repository/Hierarchy/Hierarchy.cs
URL:
http://svn.apache.org/viewcvs/logging/log4net/trunk/src/Repository/Hierarchy/Hierarchy.cs?rev=329690&r1=329689&r2=329690&view=diff
==============================================================================
--- logging/log4net/trunk/src/Repository/Hierarchy/Hierarchy.cs (original)
+++ logging/log4net/trunk/src/Repository/Hierarchy/Hierarchy.cs Sun Oct 30
17:12:53 2005
@@ -891,6 +891,9 @@
/// <para>
/// Define or redefine a Level using the values in the <see
cref="LevelEntry"/> argument
/// </para>
+ /// <para>
+ /// Supports setting levels via the configuration file.
+ /// </para>
/// </remarks>
internal void AddLevel(LevelEntry levelEntry)
{
@@ -913,11 +916,11 @@
}
/// <summary>
- /// A class to hold the value, name and display name for a
logging event
+ /// A class to hold the value, name and display name for a level
/// </summary>
/// <remarks>
/// <para>
- /// A class to hold the value, name and display name for a
logging event
+ /// A class to hold the value, name and display name for a level
/// </para>
/// </remarks>
internal class LevelEntry
@@ -982,6 +985,83 @@
public override string ToString()
{
return "LevelEntry(Value="+m_levelValue+",
Name="+m_levelName+", DisplayName="+m_levelDisplayName+")";
+ }
+ }
+
+ /// <summary>
+ /// Set a Property using the values in the <see
cref="LevelEntry"/> argument
+ /// </summary>
+ /// <param name="propertyEntry">the property value</param>
+ /// <remarks>
+ /// <para>
+ /// Set a Property using the values in the <see
cref="LevelEntry"/> argument.
+ /// </para>
+ /// <para>
+ /// Supports setting property values via the configuration file.
+ /// </para>
+ /// </remarks>
+ internal void AddProperty(PropertyEntry propertyEntry)
+ {
+ if (propertyEntry == null) throw new
ArgumentNullException("propertyEntry");
+ if (propertyEntry.Key == null) throw new
ArgumentNullException("propertyEntry.Key");
+
+ Properties[propertyEntry.Key] = propertyEntry.Value;
+ }
+
+ /// <summary>
+ /// A class to hold the key and data for a property set in the
config file
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// A class to hold the key and data for a property set in the
config file
+ /// </para>
+ /// </remarks>
+ internal class PropertyEntry
+ {
+ private string m_key = null;
+ private object m_value = null;
+
+ /// <summary>
+ /// Property Key
+ /// </summary>
+ /// <value>
+ /// Property Key
+ /// </value>
+ /// <remarks>
+ /// <para>
+ /// Property Key.
+ /// </para>
+ /// </remarks>
+ public string Key
+ {
+ get { return m_key; }
+ set { m_key = value; }
+ }
+
+ /// <summary>
+ /// Property Value
+ /// </summary>
+ /// <value>
+ /// Property Value
+ /// </value>
+ /// <remarks>
+ /// <para>
+ /// Property Value.
+ /// </para>
+ /// </remarks>
+ public object Value
+ {
+ get { return m_value; }
+ set { m_value = value; }
+ }
+
+ /// <summary>
+ /// Override <c>Object.ToString</c> to return sensible
debug info
+ /// </summary>
+ /// <returns>string info about this object</returns>
+ public override string ToString()
+ {
+ return "PropertyEntry(Key="+m_key+",
Value="+m_value+")";
}
}