public interface TaskListener
extends org.jenkinsci.remoting.SerializableOnlyOverRemoting
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
.
Modifier and Type | Field and Description |
---|---|
static TaskListener |
NULL
TaskListener that discards the output. |
Modifier and Type | Method and Description |
---|---|
default PrintWriter |
_error(String prefix,
String msg) |
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 of error(String) . |
default PrintWriter |
fatalError(String msg)
A fatal error in the build.
|
default PrintWriter |
fatalError(String format,
Object... args)
Formatter.format(String, Object[]) version of fatalError(String) . |
default Charset |
getCharset()
A charset to use for methods returning
PrintWriter . |
PrintStream |
getLogger()
This writer will receive the output of the build
|
default void |
hyperlink(String url,
String text)
Places a
HyperlinkNote on the given text. |
static final TaskListener NULL
TaskListener
that discards the output.@NonNull PrintStream getLogger()
@Restricted(value=org.kohsuke.accmod.restrictions.ProtectedExternally.class) @NonNull default Charset getCharset()
PrintWriter
.
Should match that used to construct getLogger()
.@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) default PrintWriter _error(String prefix, String msg)
default void annotate(ConsoleNote ann) throws IOException
IOException
default void hyperlink(String url, String text) throws IOException
HyperlinkNote
on the given text.url
- If this starts with '/', it's interpreted as a path within the context path.IOException
@NonNull default PrintWriter error(String msg)
@NonNull default PrintWriter error(String format, Object... args)
Formatter.format(String, Object[])
version of error(String)
.@NonNull default PrintWriter fatalError(String msg)
@NonNull default PrintWriter fatalError(String format, Object... args)
Formatter.format(String, Object[])
version of fatalError(String)
.Copyright © 2004–2021. All rights reserved.