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
Fields Modifier and Type Field Description static TaskListener
NULL
TaskListener
that discards the output.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
annotate(ConsoleNote ann)
Annotates the current position in the output log by using the given annotation.default PrintWriter
error(String msg)
An error in the build.default PrintWriter
error(String format, Object... args)
Formatter.format(String, Object[])
version oferror(String)
.default PrintWriter
fatalError(String msg)
A fatal error in the build.default PrintWriter
fatalError(String format, Object... args)
Formatter.format(String, Object[])
version offatalError(String)
.default Charset
getCharset()
A charset to use for methods returningPrintWriter
.PrintStream
getLogger()
This writer will receive the output of the builddefault void
hyperlink(String url, String text)
Places aHyperlinkNote
on the given text.
-
-
-
Field Detail
-
NULL
static final TaskListener NULL
TaskListener
that 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 aHyperlinkNote
on 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)
.
-
-