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.SerializableOnlyOverRemotingReceives 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
TaskListenerso that the user can diagnose what's going wrong.StreamTaskListeneris the most typical implementation of this interface.Implementations are generally expected to be remotable via
Channel.- Author:
- Kohsuke Kawaguchi
-
-
Field Summary
Fields Modifier and Type Field Description static TaskListenerNULLTaskListenerthat discards the output.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidannotate(ConsoleNote ann)Annotates the current position in the output log by using the given annotation.default PrintWritererror(String msg)An error in the build.default PrintWritererror(String format, Object... args)Formatter.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 CharsetgetCharset()A charset to use for methods returningPrintWriter.PrintStreamgetLogger()This writer will receive the output of the builddefault voidhyperlink(String url, String text)Places aHyperlinkNoteon the given text.
-
-
-
Field Detail
-
NULL
static final TaskListener NULL
TaskListenerthat discards the output.
-
-
Method Detail
-
getLogger
@NonNull PrintStream 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
default void annotate(ConsoleNote ann) throws IOException
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
default void hyperlink(String url, String text) throws IOException
Places aHyperlinkNoteon the given text.- Parameters:
url- If this starts with '/', it's interpreted as a path within the context path.- Throws:
IOException
-
error
@NonNull default PrintWriter error(String msg)
An error in the build.- Returns:
- A writer to receive details of the error.
-
error
@NonNull default PrintWriter error(String format, Object... args)
Formatter.format(String, Object[])version oferror(String).
-
fatalError
@NonNull default PrintWriter fatalError(String msg)
A fatal error in the build.- Returns:
- A writer to receive details of the error.
-
fatalError
@NonNull default PrintWriter fatalError(String format, Object... args)
Formatter.format(String, Object[])version offatalError(String).
-
-