588
|
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;
|
628
|
22 |
|
588
|
23 |
import com.nokia.ant.HeliumLogger;
|
|
24 |
|
|
25 |
/**
|
628
|
26 |
* This task is deprecated, please consider using the
|
|
27 |
* hlm:taskRecorder task from the logging framework.
|
|
28 |
*
|
588
|
29 |
* This task will control the outputing of the Helium logger.
|
|
30 |
*
|
|
31 |
* Example of usage, to stop logging to console:
|
|
32 |
* <pre>
|
|
33 |
* <hlm:logtoconsole action="stop"/>
|
|
34 |
* </pre>
|
|
35 |
*
|
|
36 |
* To resume logging to console:
|
|
37 |
* <pre>
|
|
38 |
* <hlm:logtoconsole action="start"/>
|
|
39 |
* </pre>
|
|
40 |
*
|
|
41 |
* @ant.task name="logtoconsole" category="Logging"
|
628
|
42 |
* @deprecated This task is deprecated, please consider using the
|
|
43 |
* hlm:taskRecorder task from the logging framework.
|
588
|
44 |
*/
|
628
|
45 |
@Deprecated
|
588
|
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 |
{
|
628
|
72 |
if (stopLogToConsole) {
|
|
73 |
log("Logging to console suspended.");
|
|
74 |
}
|
588
|
75 |
HeliumLogger.setStopLogToConsole(stopLogToConsole);
|
628
|
76 |
if (!stopLogToConsole) {
|
|
77 |
log("Logging to console resumed.");
|
|
78 |
}
|
588
|
79 |
}
|
|
80 |
}
|
|
81 |
}
|