Browse Source

Use LogLevel and thus remove the need for VerbosityLevelChoices

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270699 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 24 years ago
parent
commit
45929ed2f6
4 changed files with 14 additions and 76 deletions
  1. +7
    -12
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Recorder.java
  2. +0
    -26
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/VerbosityLevelChoices.java
  3. +7
    -12
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Recorder.java
  4. +0
    -26
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/VerbosityLevelChoices.java

+ 7
- 12
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Recorder.java View File

@@ -15,6 +15,7 @@ import java.util.Hashtable;
import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
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
@@ -87,30 +88,25 @@ public class Recorder
* @param level The new Loglevel value
* @see VerbosityLevelChoices
*/
public void setLoglevel( final VerbosityLevelChoices level )
public void setLoglevel( final LogLevel level )
{
//I hate cascading if/elseif clauses !!!
String lev = level.getValue();
if( lev.equalsIgnoreCase( "error" ) )
if( LogLevel.ERROR == level )
{
loglevel = Project.MSG_ERR;
}
else if( lev.equalsIgnoreCase( "warn" ) )
else if( LogLevel.WARN == level )
{
loglevel = Project.MSG_WARN;
}
else if( lev.equalsIgnoreCase( "info" ) )
else if( LogLevel.INFO == level )
{
loglevel = Project.MSG_INFO;
}
else if( lev.equalsIgnoreCase( "verbose" ) )
else if( LogLevel.DEBUG == level )
{
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() );
}

final PrintStream out = new PrintStream( outputStream );
return out;
return new PrintStream( outputStream );
}
}

+ 0
- 26
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/VerbosityLevelChoices.java View File

@@ -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;
}
}

+ 7
- 12
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Recorder.java View File

@@ -15,6 +15,7 @@ import java.util.Hashtable;
import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
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
@@ -87,30 +88,25 @@ public class Recorder
* @param level The new Loglevel value
* @see VerbosityLevelChoices
*/
public void setLoglevel( final VerbosityLevelChoices level )
public void setLoglevel( final LogLevel level )
{
//I hate cascading if/elseif clauses !!!
String lev = level.getValue();
if( lev.equalsIgnoreCase( "error" ) )
if( LogLevel.ERROR == level )
{
loglevel = Project.MSG_ERR;
}
else if( lev.equalsIgnoreCase( "warn" ) )
else if( LogLevel.WARN == level )
{
loglevel = Project.MSG_WARN;
}
else if( lev.equalsIgnoreCase( "info" ) )
else if( LogLevel.INFO == level )
{
loglevel = Project.MSG_INFO;
}
else if( lev.equalsIgnoreCase( "verbose" ) )
else if( LogLevel.DEBUG == level )
{
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() );
}

final PrintStream out = new PrintStream( outputStream );
return out;
return new PrintStream( outputStream );
}
}

+ 0
- 26
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/VerbosityLevelChoices.java View File

@@ -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;
}
}

Loading…
Cancel
Save