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