buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/StopLogToConsoleTask.java
changeset 645 b8d81fa19e7d
parent 643 27cf35f95864
child 646 a010554f8551
child 648 d5a8d436d33b
equal deleted inserted replaced
643:27cf35f95864 645:b8d81fa19e7d
     1 /*
       
     2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 package com.nokia.ant.taskdefs;
       
    20 
       
    21 import org.apache.tools.ant.Task;
       
    22 
       
    23 import com.nokia.ant.HeliumLogger;
       
    24 
       
    25 /**
       
    26  * This task is deprecated, please consider using the 
       
    27  * hlm:taskRecorder task from the logging framework.
       
    28  * 
       
    29  * This task will control the outputing of the Helium logger.
       
    30  * 
       
    31  * Example of usage, to stop logging to console:
       
    32  * <pre>
       
    33  * &lt;hlm:logtoconsole action="stop"/&gt;
       
    34  * </pre>
       
    35  *  
       
    36  * To resume logging to console:
       
    37  * <pre>
       
    38  * &lt;hlm:logtoconsole action="start"/&gt;
       
    39  * </pre> 
       
    40  * 
       
    41  * @ant.task name="logtoconsole" category="Logging"
       
    42  * @deprecated This task is deprecated, please consider using the 
       
    43  * hlm:taskRecorder task from the logging framework.
       
    44  */ 
       
    45 @Deprecated
       
    46 public class StopLogToConsoleTask extends Task 
       
    47 {   
       
    48     private boolean stopLogToConsole;
       
    49     
       
    50     /**
       
    51      * Action to perform, stop/start logging.
       
    52      * @ant.not-required Default value is start.
       
    53      */
       
    54     public void setAction(String msg)
       
    55     {
       
    56         if ( msg.equalsIgnoreCase("stop") )
       
    57         {
       
    58             stopLogToConsole = true;
       
    59         }
       
    60         else
       
    61         {
       
    62             stopLogToConsole = false;
       
    63         }       
       
    64     }
       
    65 
       
    66     @Override
       
    67     public void execute()
       
    68     {
       
    69         super.execute();
       
    70         if (HeliumLogger.getStopLogToConsole() != stopLogToConsole)
       
    71         {
       
    72             if (stopLogToConsole) {
       
    73                 log("Logging to console suspended.");
       
    74             }
       
    75             HeliumLogger.setStopLogToConsole(stopLogToConsole);   
       
    76             if (!stopLogToConsole) {
       
    77                 log("Logging to console resumed.");
       
    78             }
       
    79         }       
       
    80     }   
       
    81 }