ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs Recorder.java
Date Sun, 13 Jan 2002 04:51:51 GMT
donaldp     02/01/12 20:51:51

  Modified:    proposal/myrmidon/src/java/org/apache/antlib/core Log.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs
                        Recorder.java
  Added:       proposal/myrmidon/src/java/org/apache/myrmidon/framework
                        LogLevel.java
  Removed:     proposal/myrmidon/src/java/org/apache/antlib/core
                        LogLevel.java
  Log:
  MoveLogLevel class into framework
  
  Revision  Changes    Path
  1.8       +1 -0      jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/core/Log.java
  
  Index: Log.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/core/Log.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Log.java	13 Jan 2002 04:50:48 -0000	1.7
  +++ Log.java	13 Jan 2002 04:51:50 -0000	1.8
  @@ -9,6 +9,7 @@
   
   import org.apache.myrmidon.api.AbstractTask;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.framework.LogLevel;
   
   /**
    * This is a task used to log messages in the build file.
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/LogLevel.java
  
  Index: LogLevel.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.myrmidon.framework;
  
  import java.util.HashMap;
  import java.util.Set;
  import org.apache.avalon.framework.Enum;
  import org.apache.avalon.framework.logger.Logger;
  
  /**
   * Type safe Enum for Log Levels and utility method
   * for using enum to write to logger.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   */
  public final class LogLevel
      extends Enum
  {
      //Map for all the levels
      private static final HashMap c_levels = new HashMap();
  
      //standard enums for version of JVM
      public final static LogLevel FATAL_ERROR = new LogLevel( "fatalError" );
      public final static LogLevel ERROR = new LogLevel( "error" );
      public final static LogLevel WARN = new LogLevel( "warn" );
      public final static LogLevel INFO = new LogLevel( "info" );
      public final static LogLevel DEBUG = new LogLevel( "debug" );
  
      /**
       * Retrieve the log level for the specified name.
       *
       * @param name the name of the LogLevel object to retrieve
       * @returns The LogLevel for specified name or null
       */
      public static LogLevel getByName( final String name )
      {
          return (LogLevel)c_levels.get( name );
      }
  
      /**
       * Retrieve the names of all the LogLevels.
       *
       * @returns The names of all the LogLevels
       */
      public static String[] getNames()
      {
          final Set keys = c_levels.keySet();
          return (String[])keys.toArray( new String[ keys.size() ] );
      }
  
      /**
       * Log a message to the Logger at the specified level.
       */
      public static void log( final Logger logger,
                              final String message,
                              final LogLevel level )
      {
          if( LogLevel.FATAL_ERROR == level )
          {
              logger.fatalError( message );
          }
          else if( LogLevel.ERROR == level )
          {
              logger.error( message );
          }
          else if( LogLevel.WARN == level )
          {
              logger.warn( message );
          }
          else if( LogLevel.INFO == level )
          {
              logger.info( message );
          }
          else
          {
              logger.debug( message );
          }
      }
  
      /**
       * Log a message to the Logger at the specified level.
       */
      public static void log( final Logger logger,
                              final String message,
                              final Throwable throwable,
                              final LogLevel level )
      {
          if( LogLevel.FATAL_ERROR == level )
          {
              logger.fatalError( message, throwable );
          }
          else if( LogLevel.ERROR == level )
          {
              logger.error( message, throwable );
          }
          else if( LogLevel.WARN == level )
          {
              logger.warn( message, throwable );
          }
          else if( LogLevel.INFO == level )
          {
              logger.info( message, throwable );
          }
          else
          {
              logger.debug( message, throwable );
          }
      }
  
      /**
       * Private constructor so no instance except here can be defined.
       *
       * @param name the name of Log Level
       */
      private LogLevel( final String name )
      {
          super( name, c_levels );
      }
  }
  
  
  
  1.9       +1 -1      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Recorder.java
  
  Index: Recorder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Recorder.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Recorder.java	12 Jan 2002 23:40:09 -0000	1.8
  +++ Recorder.java	13 Jan 2002 04:51:51 -0000	1.9
  @@ -15,7 +15,7 @@
   import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.Task;
  -import org.apache.antlib.core.LogLevel;
  +import org.apache.myrmidon.framework.LogLevel;
   
   /**
    * This task is the manager for RecorderEntry's. It is this class that holds all
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message