public class Recorder extends Task implements SubBuildListener
Several recorders can exist at the same time. Each recorder is associated with a file. The filename is used as a unique identifier for the recorders. The first call to the recorder task with an unused filename will create a recorder (using the parameters provided) and add it to the listeners of the build. All subsequent calls to the recorder task using this filename will modify that recorders state (recording or not) or other properties (like logging level).
Some technical issues: the file's print stream is flushed for "finished" events (buildFinished, targetFinished and taskFinished), and is closed on a buildFinished event.
RecorderEntry
Modifier and Type | Class and Description |
---|---|
static class |
Recorder.ActionChoices
A list of possible values for the
setAction() method. |
static class |
Recorder.VerbosityLevelChoices
A list of possible values for the
setLoglevel() method. |
Constructor and Description |
---|
Recorder() |
Modifier and Type | Method and Description |
---|---|
void |
buildFinished(BuildEvent event)
Cleans recorder registry.
|
void |
buildStarted(BuildEvent event)
Empty implementation required by SubBuildListener interface.
|
void |
execute()
The main execution.
|
protected RecorderEntry |
getRecorder(String name,
Project proj)
Gets the recorder that's associated with the passed in name.
|
void |
init()
Overridden so we can add the task as build listener.
|
void |
messageLogged(BuildEvent event)
Empty implementation required by SubBuildListener interface.
|
void |
setAction(Recorder.ActionChoices action)
Sets the action for the associated recorder entry.
|
void |
setAppend(boolean append)
Whether or not the logger should append to a previous file.
|
void |
setEmacsMode(boolean emacsMode)
Set emacs mode.
|
void |
setLoglevel(Recorder.VerbosityLevelChoices level)
Sets the level to which this recorder entry should log to.
|
void |
setName(String fname)
Sets the name of the file to log to, and the name of the recorder
entry.
|
void |
subBuildFinished(BuildEvent event)
Cleans recorder registry, if this is the subbuild the task has
been created in.
|
void |
subBuildStarted(BuildEvent event)
Empty implementation required by SubBuildListener interface.
|
void |
targetFinished(BuildEvent event)
Empty implementation required by SubBuildListener interface.
|
void |
targetStarted(BuildEvent event)
Empty implementation required by SubBuildListener interface.
|
void |
taskFinished(BuildEvent event)
Empty implementation required by SubBuildListener interface.
|
void |
taskStarted(BuildEvent event)
Empty implementation required by SubBuildListener interface.
|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
public void buildFinished(BuildEvent event)
buildFinished
in interface BuildListener
event
- ignored.BuildEvent.getException()
public void buildStarted(BuildEvent event)
buildStarted
in interface BuildListener
event
- ignored.public void execute() throws BuildException
execute
in class Task
BuildException
- on errorprotected RecorderEntry getRecorder(String name, Project proj) throws BuildException
name
- the name of the recorderproj
- the current projectBuildException
- on errorpublic void init()
public void messageLogged(BuildEvent event)
messageLogged
in interface BuildListener
event
- ignored.BuildEvent.getMessage()
,
BuildEvent.getException()
,
BuildEvent.getPriority()
public void setAction(Recorder.ActionChoices action)
action
- The action for the entry to take: start or stop.public void setAppend(boolean append)
append
- if true, append to a previous file.public void setEmacsMode(boolean emacsMode)
emacsMode
- if true use emacs modepublic void setLoglevel(Recorder.VerbosityLevelChoices level)
level
- the level to set.Recorder.VerbosityLevelChoices
public void setName(String fname)
fname
- File name of logfile.public void subBuildFinished(BuildEvent event)
subBuildFinished
in interface SubBuildListener
event
- ignored.BuildEvent.getException()
public void subBuildStarted(BuildEvent event)
subBuildStarted
in interface SubBuildListener
event
- ignored.public void targetFinished(BuildEvent event)
targetFinished
in interface BuildListener
event
- ignored.BuildEvent.getException()
public void targetStarted(BuildEvent event)
targetStarted
in interface BuildListener
event
- ignored.BuildEvent.getTarget()
public void taskFinished(BuildEvent event)
taskFinished
in interface BuildListener
event
- ignored.BuildEvent.getException()
public void taskStarted(BuildEvent event)
taskStarted
in interface BuildListener
event
- ignored.BuildEvent.getTask()