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
Modifier and TypeFieldDescriptionstatic final TaskListener
TaskListener
that discards the output. -
Method Summary
Modifier and TypeMethodDescriptiondefault void
annotate
(ConsoleNote ann) Annotates the current position in the output log by using the given annotation.default PrintWriter
An error in the build.default PrintWriter
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
A charset to use for methods returningPrintWriter
.This writer will receive the output of the builddefault void
Places aHyperlinkNote
on the given text.Methods inherited from interface org.jenkinsci.remoting.SerializableOnlyOverRemoting
getChannelForSerialization
-
Field Details
-
NULL
TaskListener
that 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 aHyperlinkNote
on 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)
.
-