You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by rg...@apache.org on 2006/11/05 19:38:33 UTC

svn commit: r471489 - /ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/ConfigurationSectionHandler.cs

Author: rgrabowski
Date: Sun Nov  5 10:38:33 2006
New Revision: 471489

URL: http://svn.apache.org/viewvc?view=rev&rev=471489
Log:
Added CONSOLE, TRACE, and NOOP aliases for logFactoryAdapter element's type attribute.

Modified:
    ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/ConfigurationSectionHandler.cs

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/ConfigurationSectionHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/ConfigurationSectionHandler.cs?view=diff&rev=471489&r1=471488&r2=471489
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/ConfigurationSectionHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/ConfigurationSectionHandler.cs Sun Nov  5 10:38:33 2006
@@ -29,6 +29,7 @@
 using System.Collections.Specialized;
 using System.Configuration;
 using System.Xml;
+using IBatisNet.Common.Logging.Impl;
 using ConfigurationException = IBatisNet.Common.Exceptions.ConfigurationException;
 
 namespace IBatisNet.Common.Logging
@@ -99,19 +100,35 @@
 				factoryTypeString = logFactoryElement.Attributes[LOGFACTORYADAPTER_ELEMENT_TYPE_ATTRIB].Value;
             
 			if ( factoryTypeString == string.Empty )
+			{
 				throw new ConfigurationException
 					( "Required Attribute '" 
-					  + LOGFACTORYADAPTER_ELEMENT_TYPE_ATTRIB 
-					  + "' not found in element '"
-					  + LOGFACTORYADAPTER_ELEMENT
-					  + "'"
+					+ LOGFACTORYADAPTER_ELEMENT_TYPE_ATTRIB 
+					+ "' not found in element '"
+					+ LOGFACTORYADAPTER_ELEMENT
+					+ "'"
 					);
-
+			}
 
 			Type factoryType = null;
 			try
 			{
-				factoryType = Type.GetType( factoryTypeString, true, false );
+				if (String.Compare(factoryTypeString, "CONSOLE", true) == 0)
+				{
+					factoryType = typeof(ConsoleOutLoggerFA);
+				}
+				else if (String.Compare(factoryTypeString, "TRACE", true) == 0)
+				{
+					factoryType = typeof(TraceLoggerFA);
+				}
+				else if (String.Compare(factoryTypeString, "NOOP", true) == 0)
+				{
+					factoryType = typeof(NoOpLoggerFA);
+				}
+				else
+				{
+					factoryType = Type.GetType( factoryTypeString, true, false );
+				}
 			}
 			catch ( Exception e )
 			{