donaldp 02/05/27 22:12:40
Modified: container/src/java/org/apache/myrmidon/interfaces
BasicLogger.java
Log:
Move mapLogLevel to this class
Revision Changes Path
1.3 +38 -1
jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/BasicLogger.java
Index: BasicLogger.java
===================================================================
RCS file:
/home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/BasicLogger.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BasicLogger.java 23 May 2002 01:50:25 -0000 1.2
+++ BasicLogger.java 28 May 2002 05:12:40 -0000 1.3
@@ -14,7 +14,7 @@
* A basic logger that just prints out messages to <code>System.out</code>.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
- * @version $Revision: 1.2 $ $Date: 2002/05/23 01:50:25 $
+ * @version $Revision: 1.3 $ $Date: 2002/05/28 05:12:40 $
*/
public class BasicLogger
extends AbstractLogger
@@ -38,6 +38,43 @@
{
m_prefix = prefix;
m_logLevel = logLevel;
+ }
+
+ /**
+ * Map a string onto a specific LogLevel.
+ *
+ * @param logLevel the string representation of LogLevel
+ * @return the logLevel code
+ * @throws IllegalArgumentException if string does not match any levels
+ */
+ public static final int mapLogLevel( final String logLevel )
+ throws IllegalArgumentException
+ {
+ final String logLevelCapitalized = logLevel.toUpperCase();
+ if( "DEBUG".equals( logLevelCapitalized ) )
+ {
+ return BasicLogger.LEVEL_DEBUG;
+ }
+ else if( "VERBOSE".equals( logLevelCapitalized ) )
+ {
+ return BasicLogger.LEVEL_INFO;
+ }
+ else if( "INFO".equals( logLevelCapitalized ) )
+ {
+ return BasicLogger.LEVEL_WARN;
+ }
+ else if( "WARN".equals( logLevelCapitalized ) )
+ {
+ return BasicLogger.LEVEL_ERROR;
+ }
+ else if( "ERROR".equals( logLevelCapitalized ) )
+ {
+ return BasicLogger.LEVEL_FATAL;
+ }
+ else
+ {
+ throw new IllegalArgumentException( "Unknown Level: " + logLevel
);
+ }
}
/**
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>