Package hudson.model
Interface TaskListener
- All Superinterfaces:
Serializable,org.jenkinsci.remoting.SerializableOnlyOverRemoting
- All Known Subinterfaces:
BuildListener
- All Known Implementing Classes:
AbstractTaskListener,BuildListenerAdapter,LogTaskListener,StreamBuildListener,StreamTaskListener
public interface TaskListener
extends org.jenkinsci.remoting.SerializableOnlyOverRemoting
Receives events that happen during some lengthy operation
that has some chance of failures, such as a build, SCM change polling,
agent launch, and so on.
This interface is implemented by Hudson core and passed to extension points so that they can record the progress of the operation without really knowing how those information and handled/stored by Hudson.
The information is one way or the other made available to users, and
so the expectation is that when something goes wrong, enough information
shall be written to a TaskListener so that the user can diagnose
what's going wrong.
StreamTaskListener is the most typical implementation of this interface.
Implementations are generally expected to be remotable via Channel.
- Author:
- Kohsuke Kawaguchi
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TaskListenerTaskListenerthat discards the output. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidannotate(ConsoleNote ann) Annotates the current position in the output log by using the given annotation.default PrintWriterAn error in the build.default PrintWriterFormatter.format(String, Object[])version oferror(String).default PrintWriterfatalError(String msg) A fatal error in the build.default PrintWriterfatalError(String format, Object... args) Formatter.format(String, Object[])version offatalError(String).default CharsetA charset to use for methods returningPrintWriter.This writer will receive the output of the builddefault voidPlaces aHyperlinkNoteon the given text.Methods inherited from interface org.jenkinsci.remoting.SerializableOnlyOverRemoting
getChannelForSerialization
-
Field Details
-
NULL
TaskListenerthat discards the output.
-
-
Method Details
-
getLogger
This writer will receive the output of the build -
getCharset
@Restricted(org.kohsuke.accmod.restrictions.ProtectedExternally.class) @NonNull default Charset getCharset()A charset to use for methods returningPrintWriter. Should match that used to constructgetLogger().- Returns:
- by default, UTF-8
-
annotate
Annotates the current position in the output log by using the given annotation. If the implementation doesn't support annotated output log, this method might be no-op.- Throws:
IOException- Since:
- 1.349
-
hyperlink
Places aHyperlinkNoteon the given text.- Parameters:
url- If this starts with '/', it's interpreted as a path within the context path.- Throws:
IOException
-
error
An error in the build.- Returns:
- A writer to receive details of the error.
-
error
Formatter.format(String, Object[])version oferror(String). -
fatalError
A fatal error in the build.- Returns:
- A writer to receive details of the error.
-
fatalError
Formatter.format(String, Object[])version offatalError(String).
-