git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270699 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -15,6 +15,7 @@ import java.util.Hashtable; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.antlib.core.LogLevel; | |||||
| /** | /** | ||||
| * This task is the manager for RecorderEntry's. It is this class that holds all | * This task is the manager for RecorderEntry's. It is this class that holds all | ||||
| @@ -87,30 +88,25 @@ public class Recorder | |||||
| * @param level The new Loglevel value | * @param level The new Loglevel value | ||||
| * @see VerbosityLevelChoices | * @see VerbosityLevelChoices | ||||
| */ | */ | ||||
| public void setLoglevel( final VerbosityLevelChoices level ) | |||||
| public void setLoglevel( final LogLevel level ) | |||||
| { | { | ||||
| //I hate cascading if/elseif clauses !!! | //I hate cascading if/elseif clauses !!! | ||||
| String lev = level.getValue(); | |||||
| if( lev.equalsIgnoreCase( "error" ) ) | |||||
| if( LogLevel.ERROR == level ) | |||||
| { | { | ||||
| loglevel = Project.MSG_ERR; | loglevel = Project.MSG_ERR; | ||||
| } | } | ||||
| else if( lev.equalsIgnoreCase( "warn" ) ) | |||||
| else if( LogLevel.WARN == level ) | |||||
| { | { | ||||
| loglevel = Project.MSG_WARN; | loglevel = Project.MSG_WARN; | ||||
| } | } | ||||
| else if( lev.equalsIgnoreCase( "info" ) ) | |||||
| else if( LogLevel.INFO == level ) | |||||
| { | { | ||||
| loglevel = Project.MSG_INFO; | loglevel = Project.MSG_INFO; | ||||
| } | } | ||||
| else if( lev.equalsIgnoreCase( "verbose" ) ) | |||||
| else if( LogLevel.DEBUG == level ) | |||||
| { | { | ||||
| loglevel = Project.MSG_VERBOSE; | loglevel = Project.MSG_VERBOSE; | ||||
| } | } | ||||
| else if( lev.equalsIgnoreCase( "debug" ) ) | |||||
| { | |||||
| loglevel = Project.MSG_DEBUG; | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -193,7 +189,6 @@ public class Recorder | |||||
| outputStream = new FileOutputStream( name, m_append.booleanValue() ); | outputStream = new FileOutputStream( name, m_append.booleanValue() ); | ||||
| } | } | ||||
| final PrintStream out = new PrintStream( outputStream ); | |||||
| return out; | |||||
| return new PrintStream( outputStream ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,26 +0,0 @@ | |||||
| /* | |||||
| * 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.tools.ant.taskdefs; | |||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | |||||
| /** | |||||
| * A list of possible values for the <code>setLoglevel()</code> method. | |||||
| * Possible values include: error, warn, info, verbose, debug. | |||||
| */ | |||||
| public class VerbosityLevelChoices | |||||
| extends EnumeratedAttribute | |||||
| { | |||||
| private final static String[] values = | |||||
| {"error", "warn", "info", "verbose", "debug"}; | |||||
| public String[] getValues() | |||||
| { | |||||
| return values; | |||||
| } | |||||
| } | |||||
| @@ -15,6 +15,7 @@ import java.util.Hashtable; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.antlib.core.LogLevel; | |||||
| /** | /** | ||||
| * This task is the manager for RecorderEntry's. It is this class that holds all | * This task is the manager for RecorderEntry's. It is this class that holds all | ||||
| @@ -87,30 +88,25 @@ public class Recorder | |||||
| * @param level The new Loglevel value | * @param level The new Loglevel value | ||||
| * @see VerbosityLevelChoices | * @see VerbosityLevelChoices | ||||
| */ | */ | ||||
| public void setLoglevel( final VerbosityLevelChoices level ) | |||||
| public void setLoglevel( final LogLevel level ) | |||||
| { | { | ||||
| //I hate cascading if/elseif clauses !!! | //I hate cascading if/elseif clauses !!! | ||||
| String lev = level.getValue(); | |||||
| if( lev.equalsIgnoreCase( "error" ) ) | |||||
| if( LogLevel.ERROR == level ) | |||||
| { | { | ||||
| loglevel = Project.MSG_ERR; | loglevel = Project.MSG_ERR; | ||||
| } | } | ||||
| else if( lev.equalsIgnoreCase( "warn" ) ) | |||||
| else if( LogLevel.WARN == level ) | |||||
| { | { | ||||
| loglevel = Project.MSG_WARN; | loglevel = Project.MSG_WARN; | ||||
| } | } | ||||
| else if( lev.equalsIgnoreCase( "info" ) ) | |||||
| else if( LogLevel.INFO == level ) | |||||
| { | { | ||||
| loglevel = Project.MSG_INFO; | loglevel = Project.MSG_INFO; | ||||
| } | } | ||||
| else if( lev.equalsIgnoreCase( "verbose" ) ) | |||||
| else if( LogLevel.DEBUG == level ) | |||||
| { | { | ||||
| loglevel = Project.MSG_VERBOSE; | loglevel = Project.MSG_VERBOSE; | ||||
| } | } | ||||
| else if( lev.equalsIgnoreCase( "debug" ) ) | |||||
| { | |||||
| loglevel = Project.MSG_DEBUG; | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -193,7 +189,6 @@ public class Recorder | |||||
| outputStream = new FileOutputStream( name, m_append.booleanValue() ); | outputStream = new FileOutputStream( name, m_append.booleanValue() ); | ||||
| } | } | ||||
| final PrintStream out = new PrintStream( outputStream ); | |||||
| return out; | |||||
| return new PrintStream( outputStream ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,26 +0,0 @@ | |||||
| /* | |||||
| * 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.tools.ant.taskdefs; | |||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | |||||
| /** | |||||
| * A list of possible values for the <code>setLoglevel()</code> method. | |||||
| * Possible values include: error, warn, info, verbose, debug. | |||||
| */ | |||||
| public class VerbosityLevelChoices | |||||
| extends EnumeratedAttribute | |||||
| { | |||||
| private final static String[] values = | |||||
| {"error", "warn", "info", "verbose", "debug"}; | |||||
| public String[] getValues() | |||||
| { | |||||
| return values; | |||||
| } | |||||
| } | |||||